Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

possessive-js

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

possessive-js

A JavaScript library for handling singular possessive apostrophes with support for international names

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

possessive-js

npm version npm downloads License: MIT Test Status JavaScript Style Guide

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

// ESM
import Possessive from "possessive-js";

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

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

// International names
possessive.makePossessive("François"); // => "François'"
possessive.makePossessive("Strauß"); // => "Strauß'"
possessive.makePossessive("Müller"); // => "Müller's"

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

Configuration

const possessive = new Possessive({
  // Use 'alternative' for names ending in 's' to add 's (Chris's)
  // Use 'standard' for just apostrophe (Chris')
  style: "standard",

  // Language-specific rules
  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

Keywords

FAQs

Package last updated on 17 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc