Pluralizer
Low-level API for English noun pluralization and singularization with support for irregular forms, uncountable nouns, and custom rules.
The Pluralizer class provides a low‑level API to handle English word (noun) pluralization and singularization. It supports irregular forms, uncountable nouns, and allows you to extend or customize the behavior by adding new rules.
Acknowledgement
This class is heavily inspired by Blake Embrey's excellent pluralize package.
Many of the core regular expressions, irregular word mappings, and uncountable word lists were studied and adapted from the original implementation. Additional improvements, extensions, and refactoring were made to fit the needs of this project.
When to Use
- You need multiple independent configurations.
- You want to add or override rules without affecting the shared
pluralizerinstance.
Features
- ✅ Convert words between singular and plural forms.
- ✅ Built‑in default rules loaded on construction.
- ✅ Manage rules dynamically:
addPluralRule(),addSingularRule(),addIrregular(),addUncountable(). - ✅ Automatically handles irregular words (e.g.
child → children). - ✅ Detects uncountable nouns (e.g.
fish).
Alert
All methods return the trimmed word if the input has trailing spaces.
Import
import { Pluralizer } from 'toolbox-x/pluralizer';Usage
Extending Rules
You can modify your instance without affecting others:
API Reference
constructor()
Initializes with built‑in rules, irregular forms, and uncountables.
pluralize(word, options?)
Get the proper singular or plural form based on an optional count.
PluralizeOptions
| Property | Type | Description |
|---|---|---|
count | Numeric | Determines whether to use singular or plural form. If omitted, always returns the plural form. |
inclusive | boolean | Whether to include the count in the returned string. Works only if count is provided. |
Note
Any number (count) which is not 1 is considered plural. count can be a number (3) or a numeric string ("3").
toPlural(word)
Convert a word to its plural form.
toSingular(word)
Convert a word to its singular form.
isPlural(word)
Check if a word is plural.
Note
Always returns true for uncountable nouns.
isSingular(word)
Check if a word is singular.
Note
Always returns true for uncountable nouns.
addPluralRule(rule, replacement)
Add a new pluralization rule.
import { Pluralizer } from 'toolbox-x/pluralizer';
const myPluralizer = new Pluralizer();
myPluralizer.addPluralRule(/(quiz)$/i, '$1zes');addSingularRule(rule, replacement)
Add a new singularization rule.
import { Pluralizer } from 'toolbox-x/pluralizer';
const myPluralizer = new Pluralizer();
myPluralizer.addSingularRule(/(matr)ices$/i, '$1ix');addIrregular(single, plural)
Add an irregular word pair.
import { Pluralizer } from 'toolbox-x/pluralizer';
const myPluralizer = new Pluralizer();
myPluralizer.addIrregular('person', 'people');addUncountable(word)
Add a word or pattern that should never change.
import { Pluralizer } from 'toolbox-x/pluralizer';
const myPluralizer = new Pluralizer();
myPluralizer.addUncountable('information');
myPluralizer.addUncountable(/pok[eé]mon$/i);See Also
- formatUnitWithPlural — Simple utility for formatting units with pluralization.
- Verbalizer class — Similar class for verb form manipulation.
Last updated: Sun, Jun 14, 2026 07:52:00PM (UTC)
