lodash-inflection
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -187,3 +187,3 @@ // lodash-inflection.js | ||
this.plural(/s$/, 's'); | ||
this.plural(/(ax|test)is$/, '$1es'); | ||
this.plural(/^(ax|test)is$/, '$1es'); | ||
this.plural(/(octop|vir)us$/, '$1i'); | ||
@@ -197,3 +197,3 @@ this.plural(/(octop|vir)i$/, '$1i'); | ||
this.plural(/sis$/, 'ses'); | ||
this.plural(/(?:([^f])fe|([lr])?f)$/, '$1$2ves'); | ||
this.plural(/(?:([^f])fe|([lr])?f)$/, '$1$2ves'); | ||
this.plural(/(hive)$/, '$1s'); | ||
@@ -203,4 +203,4 @@ this.plural(/([^aeiouy]|qu)y$/, '$1ies'); | ||
this.plural(/(matr|vert|ind)(?:ix|ex)$/, '$1ices'); | ||
this.plural(/([m|l])ouse$/, '$1ice'); | ||
this.plural(/([m|l])ice$/, '$1ice'); | ||
this.plural(/(m|l)ouse$/, '$1ice'); | ||
this.plural(/(m|l)ice$/, '$1ice'); | ||
this.plural(/^(ox)$/, '$1en'); | ||
@@ -210,28 +210,29 @@ this.plural(/^(oxen)$/, '$1'); | ||
this.singular(/s$/, ''); | ||
this.singular(/(n)ews$/, '$1ews'); | ||
this.singular(/([ti])a$/, '$1um'); | ||
this.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/, '$1$2sis'); | ||
this.singular(/(^analy)ses$/, '$1sis'); | ||
this.singular(/([^f])ves$/, '$1fe'); | ||
this.singular(/(hive)s$/, '$1'); | ||
this.singular(/(tive)s$/, '$1'); | ||
this.singular(/([lr])ves$/, '$1f'); | ||
this.singular(/([^aeiouy]|qu)ies$/, '$1y'); | ||
this.singular(/(s)eries$/, '$1eries'); | ||
this.singular(/(m)ovies$/, '$1ovie'); | ||
this.singular(/(ss)$/, '$1'); | ||
this.singular(/(x|ch|ss|sh)es$/, '$1'); | ||
this.singular(/([m|l])ice$/, '$1ouse'); | ||
this.singular(/(bus)es$/, '$1'); | ||
this.singular(/(o)es$/, '$1'); | ||
this.singular(/(shoe)s$/, '$1'); | ||
this.singular(/(cris|ax|test)es$/, '$1is'); | ||
this.singular(/(octop|vir)i$/, '$1us'); | ||
this.singular(/(alias|status)es$/, '$1'); | ||
this.singular(/^(ox)en/, '$1'); | ||
this.singular(/(vert|ind)ices$/, '$1ex'); | ||
this.singular(/(matr)ices$/, '$1ix'); | ||
this.singular(/(quiz)zes$/, '$1'); | ||
this.singular(/(database)s$/, '$1'); | ||
this.singular(/s$/, ''); | ||
this.singular(/(ss)$/, '$1'); | ||
this.singular(/(n)ews$/, '$1ews'); | ||
this.singular(/([ti])a$/, '$1um'); | ||
this.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/, '$1$2sis'); | ||
this.singular(/(^analy)(sis|ses)$/, '$1sis'); | ||
this.singular(/([^f])ves$/, '$1fe'); | ||
this.singular(/(hive)s$/, '$1'); | ||
this.singular(/(tive)s$/, '$1'); | ||
this.singular(/([lrae])ves$/, '$1f'); | ||
this.singular(/([^aeiouy]|qu)ies$/, '$1y'); | ||
this.singular(/(s)eries$/, '$1eries'); | ||
this.singular(/(m)ovies$/, '$1ovie'); | ||
this.singular(/(x|ch|ss|sh)es$/, '$1'); | ||
this.singular(/(m|l)ice$/, '$1ouse'); | ||
this.singular(/(bus)(es)?$/, '$1'); | ||
this.singular(/(o)es$/, '$1'); | ||
this.singular(/(shoe)s$/, '$1'); | ||
this.singular(/(cris|test)(is|es)$/, '$1is'); | ||
this.singular(/^(a)x[ie]s$/, '$1xis'); | ||
this.singular(/(octop|vir)(us|i)$/, '$1us'); | ||
this.singular(/(alias|status)(es)?$/, '$1'); | ||
this.singular(/^(ox)en/, '$1'); | ||
this.singular(/(vert|ind)ices$/, '$1ex'); | ||
this.singular(/(matr)ices$/, '$1ix'); | ||
this.singular(/(quiz)zes$/, '$1'); | ||
this.singular(/(database)s$/, '$1'); | ||
@@ -244,2 +245,3 @@ this.irregular('person', 'people'); | ||
this.irregular('cow', 'kine'); | ||
this.irregular('zombie', 'zombies'); | ||
@@ -255,2 +257,6 @@ this.uncountable('equipment'); | ||
this.uncountable('jeans'); | ||
this.uncountable('moose'); | ||
this.uncountable('deer'); | ||
this.uncountable('news'); | ||
this.uncountable('music'); | ||
@@ -257,0 +263,0 @@ return this; |
{ | ||
"name": "lodash-inflection", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "ActiveSupport::Inflector, for lodash!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,55 +11,60 @@ describe('inflector', function() { | ||
describe('plurals', function() { | ||
[ | ||
var combinations = [ | ||
['rose', 'roses'], | ||
['axis', 'axes'], | ||
['virus', 'viri'], | ||
['alias', 'aliases'], | ||
['bus', 'buses'], | ||
['tomato', 'tomatoes'], | ||
['datum', 'data'], | ||
['boss', 'bosses'], | ||
['soliloquy', 'soliloquies'], | ||
['wish', 'wishes'], | ||
['parenthesis', 'parentheses'], | ||
['thesis', 'theses'], | ||
['analysis', 'analyses'], | ||
['life', 'lives'], | ||
['hive', 'hives'], | ||
['tive', 'tives'], | ||
['leaf', 'leaves'], | ||
['loaf', 'loaves'], | ||
['elf', 'elves'], | ||
['thief', 'thieves'], | ||
['hive', 'hives'], | ||
['boss', 'bosses'], | ||
['soliloquy', 'soliloquies'], | ||
['wish', 'wishes'], | ||
['vertex', 'vertices'], | ||
['series', 'series'], | ||
['movie', 'movies'], | ||
['x', 'xes'], | ||
['mouse', 'mice'], | ||
['louse', 'lice'], | ||
['bus', 'buses'], | ||
['shoe', 'shoes'], | ||
['crisis', 'crises'], | ||
['axis', 'axes'], | ||
['octopus', 'octopi'], | ||
['virus', 'viri'], | ||
['status', 'statuses'], | ||
['alias', 'aliases'], | ||
['ox', 'oxen'], | ||
['quiz', 'quizzes'] | ||
].forEach(function(word) { | ||
['vertex', 'vertices'], | ||
['index', 'indices'], | ||
['matrix', 'matrices'], | ||
['quiz', 'quizzes'], | ||
['database', 'databases'] | ||
]; | ||
describe('plurals from singular', function() { | ||
combinations.forEach(function(word) { | ||
example('pluralize', word[0], word[1]); | ||
}); | ||
}); | ||
describe('singulars', function() { | ||
[ | ||
['roses', 'rose'], | ||
['news', 'news'], | ||
['data', 'datum'], | ||
['analyses', 'analysis'], | ||
['hives', 'hive'], | ||
['soliloquies', 'soliloquy'], | ||
['series', 'series'], | ||
['movies', 'movie'], | ||
['wishes', 'wish'], | ||
['mice', 'mouse'], | ||
['buses', 'bus'], | ||
['shoes', 'shoe'], | ||
['bosses', 'boss'], | ||
['boss', 'boss'], | ||
['crises', 'crisis'], | ||
['viri', 'virus'], | ||
['statuses', 'status'], | ||
['oxen', 'ox'], | ||
['vertices', 'vertex'], | ||
['quizzes', 'quiz'], | ||
['databases', 'database'] | ||
].forEach(function(word) { | ||
example('singularize', word[0], word[1]); | ||
describe('plurals from plural', function() { | ||
combinations.forEach(function(word) { | ||
example('pluralize', word[1], word[1]); | ||
}); | ||
}); | ||
describe('singulars from plural', function() { | ||
combinations.forEach(function(word) { | ||
example('singularize', word[1], word[0]); | ||
}); | ||
}); | ||
describe('singulars from single', function() { | ||
combinations.forEach(function(word) { | ||
example('singularize', word[0], word[0]); | ||
}); | ||
}); | ||
describe('irregulars', function() { | ||
@@ -72,3 +77,4 @@ [ | ||
['move', 'moves'], | ||
['cow', 'kine'] | ||
['cow', 'kine'], | ||
['zombie', 'zombies'] | ||
].forEach(function(word) { | ||
@@ -89,3 +95,7 @@ example('pluralize', word[0], word[1]); | ||
'sheep', | ||
'jeans' | ||
'jeans', | ||
'moose', | ||
'deer', | ||
'news', | ||
'music' | ||
].forEach(function(word) { | ||
@@ -92,0 +102,0 @@ example('pluralize', word, word); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32445
568