Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
The pluralize npm package is a simple utility for converting words between their singular and plural forms. It can also handle irregular forms and uncountable nouns.
Pluralization
Converts a singular noun to its plural form, or vice versa, depending on the count provided. It also correctly handles uncountable nouns.
const pluralize = require('pluralize');
console.log(pluralize('fish')); // 'fish'
console.log(pluralize('fish', 5)); // 'fish'
console.log(pluralize('fish', 1)); // 'fish'
Singularization
Converts a plural noun to its singular form.
const pluralize = require('pluralize');
console.log(pluralize.singular('wolves')); // 'wolf'
Adding Irregular Rules
Allows the addition of custom irregular rules for nouns that do not follow the normal pluralization pattern.
const pluralize = require('pluralize');
pluralize.addIrregularRule('goose', 'geese');
console.log(pluralize('goose')); // 'geese'
Adding Uncountable Rules
Allows the addition of uncountable rules for nouns that should not be pluralized.
const pluralize = require('pluralize');
pluralize.addUncountableRule('equipment');
console.log(pluralize('equipment')); // 'equipment'
This package provides similar functionality to pluralize, including the ability to pluralize and singularize words. It also offers additional features like camelizing, underscore, humanize, etc. It is a more comprehensive solution for inflection than pluralize.
This package generates slugs from strings, which includes pluralization as part of its features. It is more focused on URL readability and SEO, whereas pluralize is solely dedicated to pluralization and singularization.
Return a pluralized or singularized word based on the input string.
npm install pluralize --save
bower install pluralize
var pluralize = require('pluralize');
pluralize(word, count, includeCount)
pluralize.plural(word)
pluralize.singular(word)
pluralize.addPluralRule(rule, replacement)
pluralize.addSingularRule(rule, replacement)
pluralize.addUncountableRule(word)
pluralize.addIrregularRule(singular, plural)
pluralize('test') // tests
pluralize('test', 1) // test
pluralize('test', 5) // tests
pluralize('test', 1, true) // 1 test
pluralize('test', 5, true) // 5 tests
// pluralize.plural() and pluralize.singular() are pretty self explanatory
plural('regex') // regexes
pluralize.addPluralRule(/gex$/i, 'gexii')
plural('regex') // regexii
plural('singles', 1) // single
pluralize.addSingularRule(/singles$/i, 'singular')
plural('singles', 1) // singular
plural('irregular') // irregulars
plural.addIrregularRule('irregular', 'regular')
plural('irregular') // regular
plural('paper') // papers
plural.addUncountableRule('paper');
plural('paper') // paper
FAQs
Pluralize and singularize any word
The npm package pluralize receives a total of 8,238,390 weekly downloads. As such, pluralize popularity was classified as popular.
We found that pluralize demonstrated a not healthy version release cadence and project activity because the last version was released 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.