Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
irregular-plurals
Advanced tools
The irregular-plurals npm package is designed to provide a simple way to handle irregular plural forms of words in English. It is particularly useful for applications that need to dynamically generate text that conforms to grammatical rules.
Get the plural form of an irregular noun
This feature allows you to retrieve the plural form of an irregular noun. You simply pass the singular form of the noun to the `get` method, and it returns the corresponding plural form.
const irregularPlurals = require('irregular-plurals');
console.log(irregularPlurals.get('mouse')); // Outputs: 'mice'
The pluralize package is similar to irregular-plurals but offers more comprehensive functionality. It not only handles irregular plurals but also correctly pluralizes regular nouns and can revert plurals to their singular form. This makes it more versatile for applications that deal with a broader range of vocabulary.
Inflection is another package that provides similar functionalities to irregular-plurals. It includes methods for pluralizing and singularizing both regular and irregular nouns. Additionally, it supports other string transformations such as camelizing, underscoring, and humanizing, making it suitable for more complex text processing tasks.
Map of nouns to their irregular plural form
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"
- If the noun ends in a "y" and is preceded by a consonant, drop the "y" and add "ies"
- If the noun ends in a "y" and is preceded by a vowel, add "s"
The list is just a JSON file and can be used anywhere.
npm install irregular-plurals
import irregularPlurals from 'irregular-plurals';
console.log(irregularPlurals.get('cactus'));
//=> 'cacti'
console.log(irregularPlurals);
/*
Map {
[addendum, 'addenda'],
[alga, 'algae'],
…
}
*/
FAQs
Map of nouns to their irregular plural form
We found that irregular-plurals demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.