blob: 7ba5c8438bf469bcf4242af0c33e964e74455fc4 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001/**
2Pluralize a word.
3
4@param word - Word to pluralize.
5@param plural - Pluralized word.
6The plural suffix will match the case of the last letter in the word.
7This option is only for extreme edge-cases. You probably won't need it.
8
9Default:
10
11- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json).
12- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*).
13- Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*).
14- All other words will have "s" added to the end (eg. *days*).
15
16@param count - Count to determine whether to use singular or plural.
17
18@example
19```
20import plur = require('plur');
21
22plur('unicorn', 4);
23//=> 'unicorns'
24
25plur('puppy', 2);
26//=> 'puppies'
27
28plur('box', 2);
29//=> 'boxes'
30
31plur('cactus', 2);
32//=> 'cacti'
33```
34 */
35declare function plur(word: string, count?: number): string;
36declare function plur(word: string, plural: string, count?: number): string;
37
38export = plur;