index.d.ts 1.0 KB

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