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

@boringnode/pluralize

v0.1.0

Published

A TypeScript port of Doctrine Inflector to pluralize and singularize English words

Readme

typescript-image npm-image npm-download-image license-image

@boringnode/pluralize is a TypeScript port of the pluralization features from Doctrine Inflector.

Built-in support for:

  • English (en, english)
  • French (fr, french)

[!NOTE] Changes to inflection rules (adding, removing, or modifying rules) will not be considered as breaking changes.

Installation

npm install @boringnode/pluralize

Usage

Simple Functions

The easiest way to use the library is with the simple functions.

import { pluralize, singularize } from '@boringnode/pluralize'

pluralize('word') // 'words'
pluralize('person') // 'people'
pluralize('child') // 'children'

singularize('words') // 'word'
singularize('people') // 'person'
singularize('children') // 'child'

Using a Different Locale

You can create an Inflector instance with a different locale.

import { Inflector } from '@boringnode/pluralize'

const inflector = new Inflector('fr')

inflector.pluralize('cheval')   // 'chevaux'
inflector.pluralize('bijou')    // 'bijoux'
inflector.singularize('chevaux') // 'cheval'

Custom Rules with Inflector Class

You can create an Inflector instance to add custom rules.

import { Inflector } from '@boringnode/pluralize'

const inflector = new Inflector()
  .addIrregular('gex', 'gexes')
  .addUninflected('pokemon')
  .addPluralRule(/(.*)gon$/i, '$1gons')
  .addSingularRule(/(.*)gons$/i, '$1gon')

inflector.pluralize('gex') // 'gexes'
inflector.pluralize('pokemon') // 'pokemon'
inflector.singularize('dragons') // 'dragon'

Creating a Custom Language Ruleset

You can create and register custom language rulesets for other languages.

import { Inflector, type LanguageRuleset } from '@boringnode/pluralize'
import {
  pattern,
  Patterns,
  Substitutions,
  Transformations,
} from '@boringnode/pluralize/builder'

const SpanishRuleset: LanguageRuleset = {
  getSingularRuleset: () => ({
    regular: new Transformations([
      { pattern: pattern('es$'), replacement: '' },
      { pattern: pattern('s$'), replacement: '' },
    ]),
    uninflected: new Patterns([pattern('lunes'), pattern('martes')]),
    irregular: new Substitutions([{ from: 'hombres', to: 'hombre' }]),
  }),
  getPluralRuleset: () => ({
    regular: new Transformations([
      { pattern: pattern('[aeiou]$'), replacement: '$&s' },
      { pattern: pattern('$'), replacement: 'es' },
    ]),
    uninflected: new Patterns([pattern('lunes'), pattern('martes')]),
    irregular: new Substitutions([{ from: 'hombre', to: 'hombres' }]),
  }),
}

// Register the ruleset
Inflector.register('es', SpanishRuleset)

// Use it
const inflector = new Inflector('es')
inflector.pluralize('gato') // 'gatos'

API

Functions

  • pluralize(word: string): string - Returns the plural form of a word
  • singularize(word: string): string - Returns the singular form of a word

Inflector Class

| Method | Description | | --------------------------------------- | ----------------------------------------------------------- | | new Inflector(locale?: string) | Creates a new inflector instance (defaults to 'en') | | Inflector.register(locale, ruleset) | Registers a custom language ruleset | | pluralize(word) | Returns the plural form of a word | | singularize(word) | Returns the singular form of a word | | addIrregular(singular, plural) | Adds an irregular word mapping | | addUninflected(word) | Adds a word that doesn't change between singular and plural | | addPluralRule(pattern, replacement) | Adds a custom pluralization rule | | addSingularRule(pattern, replacement) | Adds a custom singularization rule |

Builder Exports (@boringnode/pluralize/builder)

For creating custom language rulesets:

| Export | Description | | ----------------- | -------------------------------------------------------- | | pattern | Helper function to create a case-insensitive regex | | Patterns | A collection of patterns for uninflected words | | Transformation | Interface: { pattern: RegExp, replacement: string } | | Transformations | A collection of transformations | | Substitution | Interface: { from: string, to: string } | | Substitutions | A collection of substitutions | | Ruleset | Interface: { regular, uninflected, irregular } |