A simple word pluralizer and singularizer
npm install word-pluralizerThis is a simple word pluralizer and singularizer npm package. It allows for the conversion of singular words to their plural forms and vice versa. It also handles irregular and uncountable words. One of the key features of this package is that it allows you to create your own rules for words that may not be handled out of the box.
Please note that this package is intended to be used for educational purposes only.
To install the package, use the following npm command:
``bash`
npm install word-pluralizer
`javascript`
const {pluralize, singularize} = require('word-pluralizer');
Then, use the following functions to convert words:
`javascript`
pluralize('person'); // returns 'people'
singularize('people'); // returns 'person'
You can also add custom rules. You can do the following:
`javascript`
const {plural, singular, irregular, uncountable} = require('word-pluralizer');
`javascript`
plural(/(quiz)$/i, '$1zes');
plural(/^(ox)$/i, '$1en');
`javascript`
singular(/(quiz)zes$/i, '$1');
singular(/^(ox)en/i, '$1');
`javascript`
irregular('person', 'people');
irregular('man', 'men');
`javascript``
uncountable('money');
uncountable('rice');