pluralize

Pluralize and singularize any word

npm install pluralize
2 143 downloads in the last day
14 394 downloads in the last week
63 383 downloads in the last month

Pluralize

Return a pluralized or singularized word based on the input string.

Installation

npm install pluralize --save
bower install pluralize --save

Usage

var pluralize = require('pluralize');
  • pluralize(word, count, includeCount)
  • pluralize.plural(word)
  • pluralize.singular(word)
  • pluralize.addPluralRule(rule, replacement)
  • pluralize.addSingularRule(rule, replacement)
  • pluralize.addUncountableRule(word)
  • pluralize.addIrregularRule(singular, plural)
pluralize('test') // "tests"
pluralize('test', 1) // "test"
pluralize('test', 5) // "tests"
pluralize('test', 1, true) // "1 test"
pluralize('test', 5, true) // "5 tests"

plural('regex') // "regexes"
pluralize.addPluralRule(/gex$/i, 'gexii')
plural('regex') // "regexii"

plural('singles', 1) // "single"
pluralize.addSingularRule(/singles$/i, 'singular')
plural('singles', 1) // "singular"

plural('irregular') // "irregulars"
plural.addIrregularRule('irregular', 'regular')
plural('irregular') // "regular"

plural('paper') // "papers"
plural.addUncountableRule('paper');
plural('paper') // "paper"

License

MIT

npm loves you