possessive-js
A JavaScript library for handling singular possessive apostrophes with support for international names.
Features
- Handles English possessive rules correctly
- Supports international names (German, French, Nordic)
- Case preservation
- Configurable styles
- Zero dependencies
- Supports both CommonJS and ES Modules
- Tiny bundle size (~8KB)
Installation
npm install possessive-js
Usage
import Possessive from "possessive-js";
const Possessive = require("possessive-js");
const possessive = new Possessive();
possessive.makePossessive("John");
possessive.makePossessive("Chris");
possessive.makePossessive("François");
possessive.makePossessive("Strauß");
possessive.makePossessive("Müller");
const altPossessive = new Possessive({ style: "alternative" });
altPossessive.makePossessive("Chris");
Configuration
const possessive = new Possessive({
style: "standard",
enableFrenchRules: true,
enableGermanRules: true,
enableNordicRules: true
});
Special Cases
German Names
- Names ending in 'ß':
Strauß → Strauß'
- Names with umlauts:
Müller → Müller's
French Names
- Names ending in silent letters:
François → François'
- Names with accents:
René → René's
Nordic Names
- Names with special characters:
Åberg → Åberg's
Contributing
Pull requests are welcome! For major changes, please open an issue first.
License
MIT © Sunan Regi Maunakea