| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | /** |
| 2 | Pluralize a word. |
| 3 | |
| 4 | @param word - Word to pluralize. |
| 5 | @param plural - Pluralized word. |
| 6 | The plural suffix will match the case of the last letter in the word. |
| 7 | This option is only for extreme edge-cases. You probably won't need it. |
| 8 | |
| 9 | Default: |
| 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 | ``` |
| 20 | import plur = require('plur'); |
| 21 | |
| 22 | plur('unicorn', 4); |
| 23 | //=> 'unicorns' |
| 24 | |
| 25 | plur('puppy', 2); |
| 26 | //=> 'puppies' |
| 27 | |
| 28 | plur('box', 2); |
| 29 | //=> 'boxes' |
| 30 | |
| 31 | plur('cactus', 2); |
| 32 | //=> 'cacti' |
| 33 | ``` |
| 34 | */ |
| 35 | declare function plur(word: string, count?: number): string; |
| 36 | declare function plur(word: string, plural: string, count?: number): string; |
| 37 | |
| 38 | export = plur; |