npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

possessive-js

v0.2.2

Published

A small JavaScript library for formatting singular English possessive forms

Downloads

37

Readme

possessive-js

npm version npm downloads License: MIT Test Status

A small JavaScript library for formatting singular English possessive forms with predictable defaults and ESM-first package support.

Features

  • Small public API
  • ESM-first usage and package exports
  • Singular possessive formatting for common English cases
  • Configurable handling for words ending in s
  • Special-case pronoun exceptions such as it -> its
  • Case-preserving output for lowercase, uppercase, and title-case inputs
  • Published TypeScript declarations
  • Zero runtime dependencies

Installation

npm install possessive-js

Requires Node.js 18 or newer.

Usage

import Possessive from "possessive-js";

const possessive = new Possessive();

possessive.makePossessive("John"); // => "John's"
possessive.makePossessive("Chris"); // => "Chris'"
possessive.makePossessive("It"); // => "Its"
possessive.makePossessive("Strauss"); // => "Strauss'"

const alternative = new Possessive({ style: "alternative" });
alternative.makePossessive("Chris"); // => "Chris's"

CommonJS compatibility:

const Possessive = require("possessive-js");

const possessive = new Possessive();
possessive.makePossessive("John"); // => "John's"

API

Generated API reference: docs/API.md

new Possessive(options?)

const possessive = new Possessive({
  style: "standard"
});

Options:

  • style: "standard" or "alternative". Controls whether words ending in s become Chris' or Chris's.

makePossessive(noun)

Formats a singular noun or name into its possessive form.

Examples:

  • John -> John's
  • Chris -> Chris'
  • James -> James'
  • Strauss -> Strauss'
  • It -> Its
  • THEY -> THEIR

Notes:

  • Input is trimmed before formatting.
  • Custom exceptions take precedence over the built-in suffix rules.
  • Existing possessive strings are not specially detected or normalized.
  • Mixed-case inputs are handled conservatively.
  • The package is intentionally English-only.

Real-World Use Cases

  • Generated UI labels: ${possessive.makePossessive(companyName)} settings
  • Profile and ownership pages: ${possessive.makePossessive(userName)} dashboard
  • CMS and publishing systems generating titles from author or organization names
  • Emails, exports, and PDFs that need the same possessive formatting rules as the main app

addException(noun, possessiveForm)

Registers a custom exact-word exception before suffix rules are applied.

const possessive = new Possessive();
possessive.addException("boss", "bosses'");

possessive.makePossessive("boss"); // => "bosses'"
possessive.makePossessive("Boss"); // => "Bosses'"
possessive.makePossessive("BOSS"); // => "BOSSES'"

Non-goals

  • Plural possessives are out of scope.
  • The library does not attempt full grammar or language detection.
  • Non-English language support is out of scope.
  • Mixed-case inputs are handled conservatively rather than with linguistic inference.

If your product localizes beyond English, use this package only for the English slice of that localization system.

Development

npm run format
npm run lint
npm run changelog
npm run docs
npm run verify

docs regenerates the API reference from JSDoc comments in src/index.js.

changelog generates draft release notes from Conventional Commit history. Review and edit the result manually before committing it.

verify runs linting, coverage, build, CJS/ESM smoke tests, API docs generation, and a package dry-run.

License

MIT © Sunan Regi Maunakea