2016-10-10 03:43:44 +02:00
|
|
|
# irregular-plurals [![Build Status](https://travis-ci.org/sindresorhus/irregular-plurals.svg?branch=master)](https://travis-ci.org/sindresorhus/irregular-plurals)
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
> Map of nouns to their irregular plural form
|
|
|
|
|
|
|
|
|
2016-10-10 03:43:44 +02:00
|
|
|
> An irregular plural in this library is defined as a noun that cannot be made plural by applying these rules:
|
|
|
|
> - If the noun ends in an "s", "x", "z", "ch" or "sh", add "es"
|
2017-12-27 19:33:54 +01:00
|
|
|
> - If the noun ends in a "y" and is preceded by a consonant, drop the "y" and add "ies"
|
2016-10-10 03:43:44 +02:00
|
|
|
> - If the noun ends in a "y" and is preceded by a vowel, add "s"
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
The list is just a [JSON file](irregular-plurals.json) and can be used wherever.
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```
|
2017-08-14 05:01:11 +02:00
|
|
|
$ npm install irregular-plurals
|
2016-10-10 03:43:44 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```js
|
|
|
|
const irregularPlurals = require('irregular-plurals');
|
|
|
|
|
|
|
|
console.log(irregularPlurals['cactus']);
|
|
|
|
//=> 'cacti'
|
|
|
|
|
|
|
|
console.log(irregularPlurals);
|
|
|
|
/*
|
2017-08-14 05:01:11 +02:00
|
|
|
{
|
|
|
|
addendum: 'addenda',
|
|
|
|
alga: 'algae',
|
|
|
|
…
|
|
|
|
}
|
2016-10-10 03:43:44 +02:00
|
|
|
*/
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Related
|
|
|
|
|
|
|
|
- [plur](https://github.com/sindresorhus/plur) - Pluralize a word
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|