Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pluralize

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pluralize - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

92

index.js

@@ -113,45 +113,52 @@ var singularRules = [],

pluralize.addIrregularRule = function (singular, plural) {
irregular[singular] = plural; // Hashed pattern for faster lookup
irregular[singular.toLowerCase()] = plural.toLowerCase();
};
// Pronouns
pluralize.addIrregularRule('i', 'we');
pluralize.addIrregularRule('me', 'us');
pluralize.addIrregularRule('he', 'they');
pluralize.addIrregularRule('she', 'they');
pluralize.addIrregularRule('them', 'them');
pluralize.addIrregularRule('myself', 'ourselves');
pluralize.addIrregularRule('I', 'we');
pluralize.addIrregularRule('me', 'us');
pluralize.addIrregularRule('he', 'they');
pluralize.addIrregularRule('she', 'they');
pluralize.addIrregularRule('them', 'them');
pluralize.addIrregularRule('myself', 'ourselves');
pluralize.addIrregularRule('yourself', 'yourselves');
pluralize.addIrregularRule('itself', 'themselves');
pluralize.addIrregularRule('herself', 'themselves');
pluralize.addIrregularRule('himself', 'themselves');
pluralize.addIrregularRule('itself', 'themselves');
pluralize.addIrregularRule('herself', 'themselves');
pluralize.addIrregularRule('himself', 'themselves');
pluralize.addIrregularRule('themself', 'themselves');
// Words ending in with a consonant and `o`
pluralize.addIrregularRule('canto', 'cantos');
pluralize.addIrregularRule('hetero', 'heteros');
pluralize.addIrregularRule('photo', 'photos');
pluralize.addIrregularRule('zero', 'zeros');
pluralize.addIrregularRule('piano', 'pianos');
pluralize.addIrregularRule('canto', 'cantos');
pluralize.addIrregularRule('hetero', 'heteros');
pluralize.addIrregularRule('photo', 'photos');
pluralize.addIrregularRule('zero', 'zeros');
pluralize.addIrregularRule('piano', 'pianos');
pluralize.addIrregularRule('portico', 'porticos');
pluralize.addIrregularRule('pro', 'pros');
pluralize.addIrregularRule('quarto', 'quartos');
pluralize.addIrregularRule('kimono', 'kimonos');
pluralize.addIrregularRule('pro', 'pros');
pluralize.addIrregularRule('quarto', 'quartos');
pluralize.addIrregularRule('kimono', 'kimonos');
// Anything else
pluralize.addIrregularRule('ox', 'oxen');
pluralize.addIrregularRule('die', 'dice');
pluralize.addIrregularRule('foot', 'feet');
pluralize.addIrregularRule('goose', 'geese');
pluralize.addIrregularRule('quiz', 'quizzes');
pluralize.addIrregularRule('human', 'humans');
pluralize.addIrregularRule('proof', 'proofs');
pluralize.addIrregularRule('carve', 'carves');
pluralize.addIrregularRule('valve', 'valves');
pluralize.addIrregularRule('thief', 'thieves');
pluralize.addIrregularRule('ox', 'oxen');
pluralize.addIrregularRule('die', 'dice');
pluralize.addIrregularRule('foot', 'feet');
pluralize.addIrregularRule('goose', 'geese');
pluralize.addIrregularRule('quiz', 'quizzes');
pluralize.addIrregularRule('human', 'humans');
pluralize.addIrregularRule('proof', 'proofs');
pluralize.addIrregularRule('carve', 'carves');
pluralize.addIrregularRule('valve', 'valves');
pluralize.addIrregularRule('thief', 'thieves');
pluralize.addIrregularRule('genie', 'genies');
pluralize.addIrregularRule('groove', 'grooves');
pluralize.addIrregularRule('stigma', 'stigmata');
// Ends with `us`
pluralize.addIrregularRule('genus', 'genera');
pluralize.addIrregularRule('genus', 'genera');
pluralize.addIrregularRule('viscus', 'viscera');
pluralize.addIrregularRule('syllabus', 'syllabi');
// Ends with `ma`
pluralize.addIrregularRule('stigma', 'stigmata');
pluralize.addIrregularRule('stoma', 'stomata');
pluralize.addIrregularRule('dogma', 'dogmata');
pluralize.addIrregularRule('lemma', 'lemmata');
pluralize.addIrregularRule('schema', 'schemata');
pluralize.addIrregularRule('anathema', 'anathemata');
// Pluralization regular expressions
pluralize.addPluralRule(/$/, 's');

@@ -164,8 +171,8 @@ pluralize.addPluralRule(/s$/, 's');

pluralize.addPluralRule(/([^l]ias|[aeiou]las|[emjzr]as)$/, '$1');
pluralize.addPluralRule(/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc)(us|i)$/, '$1i');
pluralize.addPluralRule(/^(alumn|alg|vertebr)(a|ae)$/, '$1ae');
pluralize.addPluralRule(/(bu)s$/, '$1ses');
pluralize.addPluralRule(/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc)(?:us|i)$/, '$1i');
pluralize.addPluralRule(/^(alumn|alg|vertebr)(?:a|ae)$/, '$1ae');
pluralize.addPluralRule(/([^aeiou])o$/, '$1oes');
pluralize.addPluralRule(/^(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi)(a|um)$/, '$1a');
pluralize.addPluralRule(/^(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|\w+hedr)(a|on)$/, '$1a');
pluralize.addPluralRule(/^(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/, '$1a');
pluralize.addPluralRule(/^(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|\w+hedr)(?:a|on)$/, '$1a');
pluralize.addPluralRule(/sis$/, 'ses');

@@ -175,3 +182,3 @@ pluralize.addPluralRule(/(?:([^f])fe|(ar|l|[eo][ao])f)$/, '$1$2ves');

pluralize.addPluralRule(/(x|ch|ss|sh|zz)$/, '$1es');
pluralize.addPluralRule(/(matr|cod|mur|sil|vert|ind)(ix|ex)$/, '$1ices');
pluralize.addPluralRule(/(matr|cod|mur|sil|vert|ind)(?:ix|ex)$/, '$1ices');
pluralize.addPluralRule(/^(m|l)(ice|ouse)$/, '$1ice');

@@ -183,6 +190,7 @@ pluralize.addPluralRule(/(pe)(rson|ople)$/, '$1ople');

// Singularization regular expressions
pluralize.addSingularRule(/s$/, '');
pluralize.addSingularRule(/(ss)$/, '$1');
pluralize.addSingularRule(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/, '$1sis');
pluralize.addSingularRule(/(^analy)(sis|ses)$/, '$1sis');
pluralize.addSingularRule(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(?:sis|ses)$/, '$1sis');
pluralize.addSingularRule(/(^analy)(?:sis|ses)$/, '$1sis');
pluralize.addSingularRule(/([^afor])ves$/, '$1fe');

@@ -195,3 +203,3 @@ pluralize.addSingularRule(/(hive|tive|dr?ive)s$/, '$1');

pluralize.addSingularRule(/^(m|l)ice$/, '$1ouse');
pluralize.addSingularRule(/(bus|alias|[mpst]us|atlas|gas)(es)?$/, '$1');
pluralize.addSingularRule(/(bus|alias|[impst]us|atlas|gas)(?:es)?$/, '$1');
pluralize.addSingularRule(/(e[mn]u)s?$/, '$1');

@@ -201,5 +209,5 @@ pluralize.addSingularRule(/(o)es$/, '$1');

pluralize.addSingularRule(/(shoe|movie|move)s$/, '$1');
pluralize.addSingularRule(/(cris|test|diagnos)(is|es)$/, '$1is');
pluralize.addSingularRule(/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc)(us|i)$/, '$1us');
pluralize.addSingularRule(/^(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi)a$/, '$1um');
pluralize.addSingularRule(/(cris|test|diagnos)(?:is|es)$/, '$1is');
pluralize.addSingularRule(/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc)(?:us|i)$/, '$1us');
pluralize.addSingularRule(/^(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)a$/, '$1um');
pluralize.addSingularRule(/^(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|\w+hedr)a$/, '$1on');

@@ -206,0 +214,0 @@ pluralize.addSingularRule(/^(alumn|alg|vertebr)ae$/, '$1a');

{
"name": "pluralize",
"version": "0.0.4",
"version": "0.0.5",
"description": "Pluralize and singularize words with ease",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,6 +19,10 @@ /*global describe,it*/

['starfish', 'starfish'],
['chickenpox', 'chickenpox'],
// Pluralization
['man', 'men'],
['superman', 'supermen'],
['ox', 'oxen'],
['bus', 'buses'],
['airbus', 'airbuses'],
['railbus', 'railbuses'],
['wife', 'wives'],

@@ -73,3 +77,3 @@ ['guest', 'guests'],

['genus', 'genera'],
['dogma', 'dogmas'],
['dogma', 'dogmata'],
['life', 'lives'],

@@ -97,3 +101,3 @@ ['hive', 'hives'],

['stigma', 'stigmata'],
['schema', 'schemas'],
['schema', 'schemata'],
['phenomenon', 'phenomena'],

@@ -239,3 +243,21 @@ ['diagnosis', 'diagnoses'],

['crust', 'crusts'],
['chickenpox', 'chickenpox']
['stigma', 'stigmata'],
['lemma', 'lemmata'],
['anathema', 'anathemata'],
['locus', 'loci'],
['uterus', 'uteri'],
['automatum', 'automata'],
['curriculum', 'curricula'],
['quorum', 'quora'],
['genie', 'genies'],
['genius', 'geniuses'],
['flower', 'flowers'],
['crash', 'crashes'],
['soul', 'souls'],
['career', 'careers'],
['planet', 'planets'],
['son', 'sons'],
['sun', 'suns'],
['drink', 'drinks'],
['diploma', 'diplomas']
];

@@ -242,0 +264,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc