plur-count
v8.0.0
Published
Pluralize a word with the number
Downloads
270
Maintainers
Readme
plur-count
Pluralize a word with the number
Install
npm install plur-countUsage
import plurCount from 'plur-count';
plurCount(4, 'unicorn');
//=> '4 unicorns'
plurCount(2, 'puppy');
//=> '2 puppies'
plurCount(2, 'box');
//=> '2 boxes'
plurCount(2, 'cactus');
//=> '2 cacti'API
plurCount(count, word, plural?)
count
Type: number
The count to determine whether to use singular or plural.
word
Type: string
The word to pluralize.
plural
Type: string
Default:
- Irregular nouns will use this list.
- Words ending in s, x, z, ch, sh will be pluralized with -es (eg. foxes).
- Words ending in y that are preceded by a consonant will be pluralized by replacing y with -ies (eg. puppies).
- All other words will have "s" added to the end (eg. days).
Explicitly provide the pluralized word.
The plural suffix will match the case of the last letter in the word.
This option is only for extreme edge-cases. You probably won't need it.
