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

inflection

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inflection - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

2

bower.json
{
"name": "inflection",
"version": "1.5.0",
"version": "1.5.1",
"homepage": "https://github.com/dreamerslab/node.inflection",

@@ -5,0 +5,0 @@ "description": "JavaScript Inflection Support",

{
"name": "inflection",
"version": "1.5.0",
"version": "1.5.1",
"repo": "dreamerslab/node.inflection",

@@ -5,0 +5,0 @@ "description": "A port of inflection-js to node.js module",

# History
## 1.5.1 / 2014-09-23
- [bug fix] Fix `whereas` plural & singular form
## 1.5.0 / 2014-09-23

@@ -4,0 +10,0 @@

@@ -11,21 +11,22 @@ /*!

}else{if(typeof exports==="object"){module.exports=b();}else{a.inflection=b();}}}(this,function(){var d=["access","accommodation","adulthood","advertising","advice","aggression","aid","air","aircraft","alcohol","anger","applause","arithmetic","art","assistance","athletics","attention","bacon","baggage","ballet","beauty","beef","beer","behavior","biology","blood","botany","bread","business","butter","carbon","cardboard","cash","chalk","chaos","chess","crossroads","countryside","damage","dancing","danger","deer","delight","dessert","dignity","dirt","distribution","dust","economics","education","electricity","employment","energy","engineering","enjoyment","entertainment","envy","equipment","ethics","evidence","evolution","failure","faith","fame","fiction","flour","flu","food","freedom","fruit","fuel","fun","furniture","gallows","garbage","garlic","gas","genetics","glass","gold","golf","gossip","grammar","grass","gratitude","grief","ground","guilt","gymnastics","hair","happiness","hardware","harm","hate","hatred","health","heat","height","help","homework","honesty","honey","hospitality","housework","humour","hunger","hydrogen","ice","importance","inflation","information","injustice","innocence","intelligence","iron","irony","jam","jealousy","jelly","jewelry","joy","judo","juice","justice","karate","kindness","knowledge","labour","lack","land","laughter","lava","leather","leisure","lightning","linguine","linguini","linguistics","literature","litter","livestock","logic","loneliness","love","luck","luggage","macaroni","machinery","magic","mail","management","mankind","marble","mathematics","mayonnaise","measles","meat","metal","methane","milk","money","mud","music","mumps","nature","news","nitrogen","nonsense","nurture","nutrition","obedience","obesity","oil","oxygen","paper","passion","pasta","patience","permission","physics","poetry","pollution","poverty","power","pride","production","progress","pronunciation","psychology","publicity","punctuation","quality","quantity","quartz","racism","rain","recreation","relaxation","reliability","research","respect","revenge","rice","rubbish","rum","safety","salad","salt","sand","satire","scenery","seafood","seaside","series","shame","sheep","shopping","silence","sleep","smoke","smoking","snow","soap","software","soil","sorrow","soup","spaghetti","speed","species","spelling","sport","steam","strength","stuff","stupidity","success","sugar","sunshine","symmetry","tea","tennis","thirst","thunder","timber","time","toast","tolerance","trade","traffic","transportation","travel","trust","understanding","underwear","unemployment","unity","usage","validity","veal","vegetation","vegetarianism","vengeance","violence","vision","vitality","warmth","water","wealth","weather","weight","welfare","wheat","whiskey","width","wildlife","wine","wisdom","wood","wool","work","yeast","yoga","zinc","zoology"];
var g=[[new RegExp("^(m)en$","gi")],[new RegExp("(pe)ople$","gi")],[new RegExp("(child)ren$","gi")],[new RegExp("([ti])a$","gi")],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi")],[new RegExp("(hi|ti)ves$","gi")],[new RegExp("(curve)s$","gi")],[new RegExp("([lr])ves$","gi")],[new RegExp("([^fo])ves$","gi")],[new RegExp("([^aeiouy]|qu)ies$","gi")],[new RegExp("(s)eries$","gi")],[new RegExp("(m)ovies$","gi")],[new RegExp("(x|ch|ss|sh)es$","gi")],[new RegExp("([m|l])ice$","gi")],[new RegExp("(bus)es$","gi")],[new RegExp("(o)es$","gi")],[new RegExp("(shoe)s$","gi")],[new RegExp("(cris|ax|test)es$","gi")],[new RegExp("(octop|vir)i$","gi")],[new RegExp("(alias|status)es$","gi")],[new RegExp("^(summons)es$","gi")],[new RegExp("^(ox)en","gi")],[new RegExp("(vert|ind)ices$","gi")],[new RegExp("(matr)ices$","gi")],[new RegExp("^feet$","gi")],[new RegExp("^teeth$","gi")],[new RegExp("^geese$","gi")],[new RegExp("(quiz)zes$","gi")],[new RegExp("^(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("^(summons)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat|volcan)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hi|ti)ve$","gi"),"$1ves"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("^foot$","gi"),"feet"],[new RegExp("^tooth$","gi"),"teeth"],[new RegExp("^goose$","gi"),"geese"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]];
var a=[[new RegExp("^(m)an$","gi")],[new RegExp("(pe)rson$","gi")],[new RegExp("(child)$","gi")],[new RegExp("^(ox)$","gi")],[new RegExp("(ax|test)is$","gi")],[new RegExp("(octop|vir)us$","gi")],[new RegExp("(alias|status)$","gi")],[new RegExp("^(summons)$","gi")],[new RegExp("(bu)s$","gi")],[new RegExp("(buffal|tomat|potat)o$","gi")],[new RegExp("([ti])um$","gi")],[new RegExp("sis$","gi")],[new RegExp("(?:([^f])fe|([lr])f)$","gi")],[new RegExp("(hi|ti)ve$","gi")],[new RegExp("([^aeiouy]|qu)y$","gi")],[new RegExp("(x|ch|ss|sh)$","gi")],[new RegExp("(matr|vert|ind)ix|ex$","gi")],[new RegExp("([m|l])ouse$","gi")],[new RegExp("^foot$","gi")],[new RegExp("^tooth$","gi")],[new RegExp("^goose$","gi")],[new RegExp("(quiz)$","gi")],[new RegExp("^(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hi|ti)ves$","gi"),"$1ve"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(summons)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("^feet$","gi"),"foot"],[new RegExp("^teeth$","gi"),"tooth"],[new RegExp("^geese$","gi"),"goose"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("ss$","gi"),"ss"],[new RegExp("s$","gi"),""]];
var c=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"];var j=new RegExp("(_ids|_id)$","g");
var f=new RegExp("_","g");var i=new RegExp("[ _]","g");var e=new RegExp("([A-Z])","g");var h=new RegExp("^_");var b={_apply_rules:function(p,o,n,m){if(m){p=m;
}else{var q=(b.indexOf(n,p.toLowerCase())>-1);if(!q){var l=0;var k=o.length;for(;l<k;l++){if(p.match(o[l][0])){if(o[l][1]!==undefined){p=p.replace(o[l][0],o[l][1]);
}break;}}}}return p;},indexOf:function(k,q,p,l){if(!p){p=-1;}var n=-1;var o=p;var m=k.length;for(;o<m;o++){if(k[o]===q||l&&l(k[o],q)){n=o;break;}}return n;
},pluralize:function(l,k){return b._apply_rules(l,g,d,k);},singularize:function(l,k){return b._apply_rules(l,a,d,k);},inflect:function(n,m,l,k){m=parseInt(m,10);
if(isNaN(m)){return n;}if(m===0||m>1){return b._apply_rules(n,g,d,k);}else{return b._apply_rules(n,a,d,l);}},camelize:function(t,o){var v=t.split("/");
var i={plural:{men:new RegExp("^(m)en$","gi"),people:new RegExp("(pe)ople$","gi"),children:new RegExp("(child)ren$","gi"),tia:new RegExp("([ti])a$","gi"),analyses:new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),hives:new RegExp("(hi|ti)ves$","gi"),curves:new RegExp("(curve)s$","gi"),lrves:new RegExp("([lr])ves$","gi"),foves:new RegExp("([^fo])ves$","gi"),movies:new RegExp("(m)ovies$","gi"),aeiouyies:new RegExp("([^aeiouy]|qu)ies$","gi"),series:new RegExp("(s)eries$","gi"),xes:new RegExp("(x|ch|ss|sh)es$","gi"),mice:new RegExp("([m|l])ice$","gi"),buses:new RegExp("(bus)es$","gi"),oes:new RegExp("(o)es$","gi"),shoes:new RegExp("(shoe)s$","gi"),crises:new RegExp("(cris|ax|test)es$","gi"),octopi:new RegExp("(octop|vir)i$","gi"),aliases:new RegExp("(alias|status)es$","gi"),summonses:new RegExp("^(summons)es$","gi"),oxen:new RegExp("^(ox)en","gi"),matrices:new RegExp("(matr)ices$","gi"),vertices:new RegExp("(vert|ind)ices$","gi"),feet:new RegExp("^feet$","gi"),teeth:new RegExp("^teeth$","gi"),geese:new RegExp("^geese$","gi"),quizzes:new RegExp("(quiz)zes$","gi"),whereases:new RegExp("^(whereas)es$","gi"),ss:new RegExp("ss$","gi"),s:new RegExp("s$","gi")},singular:{man:new RegExp("^(m)an$","gi"),person:new RegExp("(pe)rson$","gi"),child:new RegExp("(child)$","gi"),ox:new RegExp("^(ox)$","gi"),axis:new RegExp("(ax|test)is$","gi"),octopus:new RegExp("(octop|vir)us$","gi"),alias:new RegExp("(alias|status)$","gi"),summons:new RegExp("^(summons)$","gi"),bus:new RegExp("(bu)s$","gi"),buffalo:new RegExp("(buffal|tomat|potat)o$","gi"),tium:new RegExp("([ti])um$","gi"),sis:new RegExp("sis$","gi"),ffe:new RegExp("(?:([^f])fe|([lr])f)$","gi"),hive:new RegExp("(hi|ti)ve$","gi"),aeiouyy:new RegExp("([^aeiouy]|qu)y$","gi"),x:new RegExp("(x|ch|ss|sh)$","gi"),matrix:new RegExp("(matr)ix$","gi"),vertex:new RegExp("(vert|ind)ex$","gi"),mouse:new RegExp("([m|l])ouse$","gi"),foot:new RegExp("^foot$","gi"),tooth:new RegExp("^tooth$","gi"),goose:new RegExp("^goose$","gi"),quiz:new RegExp("(quiz)$","gi"),whereas:new RegExp("^(whereas)$","gi"),s:new RegExp("s$","gi"),common:new RegExp("$","gi")}};
var g=[[i.plural.men],[i.plural.people],[i.plural.children],[i.plural.tia],[i.plural.analyses],[i.plural.hives],[i.plural.curves],[i.plural.lrves],[i.plural.foves],[i.plural.aeiouyies],[i.plural.series],[i.plural.movies],[i.plural.xes],[i.plural.mice],[i.plural.buses],[i.plural.oes],[i.plural.shoes],[i.plural.crises],[i.plural.octopi],[i.plural.aliases],[i.plural.summonses],[i.plural.oxen],[i.plural.matrices],[i.plural.feet],[i.plural.teeth],[i.plural.geese],[i.plural.quizzes],[i.plural.whereases],[i.singular.man,"$1en"],[i.singular.person,"$1ople"],[i.singular.child,"$1ren"],[i.singular.ox,"$1en"],[i.singular.axis,"$1es"],[i.singular.octopus,"$1i"],[i.singular.alias,"$1es"],[i.singular.summons,"$1es"],[i.singular.bus,"$1ses"],[i.singular.buffalo,"$1oes"],[i.singular.tium,"$1a"],[i.singular.sis,"ses"],[i.singular.ffe,"$1$2ves"],[i.singular.hive,"$1ves"],[i.singular.aeiouyy,"$1ies"],[i.singular.x,"$1es"],[i.singular.matrix,"$1ices"],[i.singular.vertex,"$1ices"],[i.singular.mouse,"$1ice"],[i.singular.foot,"feet"],[i.singular.tooth,"teeth"],[i.singular.goose,"geese"],[i.singular.quiz,"$1zes"],[i.singular.whereas,"$1es"],[i.singular.s,"s"],[i.singular.common,"s"]];
var a=[[i.singular.man],[i.singular.person],[i.singular.child],[i.singular.ox],[i.singular.axis],[i.singular.octopus],[i.singular.alias],[i.singular.summons],[i.singular.bus],[i.singular.buffalo],[i.singular.tium],[i.singular.sis],[i.singular.ffe],[i.singular.hive],[i.singular.aeiouyy],[i.singular.x],[i.singular.matrix],[i.singular.mouse],[i.singular.foot],[i.singular.tooth],[i.singular.goose],[i.singular.quiz],[i.singular.whereas],[i.plural.men,"$1an"],[i.plural.people,"$1rson"],[i.plural.children,"$1"],[i.plural.tia,"$1um"],[i.plural.analyses,"$1$2sis"],[i.plural.hives,"$1ve"],[i.plural.curves,"$1"],[i.plural.lrves,"$1f"],[i.plural.foves,"$1fe"],[i.plural.movies,"$1ovie"],[i.plural.aeiouyies,"$1y"],[i.plural.series,"$1eries"],[i.plural.xes,"$1"],[i.plural.mice,"$1ouse"],[i.plural.buses,"$1"],[i.plural.oes,"$1"],[i.plural.shoes,"$1"],[i.plural.crises,"$1is"],[i.plural.octopi,"$1us"],[i.plural.aliases,"$1"],[i.plural.summonses,"$1"],[i.plural.oxen,"$1"],[i.plural.matrices,"$1ix"],[i.plural.vertices,"$1ex"],[i.plural.feet,"foot"],[i.plural.teeth,"tooth"],[i.plural.geese,"goose"],[i.plural.quizzes,"$1"],[i.plural.whereases,"$1"],[i.plural.ss,"ss"],[i.plural.s,""]];
var c=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"];var k=new RegExp("(_ids|_id)$","g");
var f=new RegExp("_","g");var j=new RegExp("[ _]","g");var e=new RegExp("([A-Z])","g");var h=new RegExp("^_");var b={_apply_rules:function(q,p,o,n){if(n){q=n;
}else{var r=(b.indexOf(o,q.toLowerCase())>-1);if(!r){var m=0;var l=p.length;for(;m<l;m++){if(q.match(p[m][0])){if(p[m][1]!==undefined){q=q.replace(p[m][0],p[m][1]);
}break;}}}}return q;},indexOf:function(l,r,q,m){if(!q){q=-1;}var o=-1;var p=q;var n=l.length;for(;p<n;p++){if(l[p]===r||m&&m(l[p],r)){o=p;break;}}return o;
},pluralize:function(m,l){return b._apply_rules(m,g,d,l);},singularize:function(m,l){return b._apply_rules(m,a,d,l);},inflect:function(o,n,m,l){n=parseInt(n,10);
if(isNaN(n)){return o;}if(n===0||n>1){return b._apply_rules(o,g,d,l);}else{return b._apply_rules(o,a,d,m);}},camelize:function(t,o){var v=t.split("/");
var r=0;var q=v.length;var u,m,p,n,s;for(;r<q;r++){u=v[r].split("_");p=0;n=u.length;for(;p<n;p++){if(p!==0){u[p]=u[p].toLowerCase();}s=u[p].charAt(0);s=o&&r===0&&p===0?s.toLowerCase():s.toUpperCase();
u[p]=s+u[p].substring(1);}v[r]=u.join("");}return v.join("::");},underscore:function(n,o){if(o&&n===n.toUpperCase()){return n;}var k=n.split("::");var m=0;
var l=k.length;for(;m<l;m++){k[m]=k[m].replace(e,"_$1");k[m]=k[m].replace(h,"");}return k.join("/").toLowerCase();},humanize:function(l,k){l=l.toLowerCase();
l=l.replace(j,"");l=l.replace(f," ");if(!k){l=b.capitalize(l);}return l;},capitalize:function(k){k=k.toLowerCase();return k.substring(0,1).toUpperCase()+k.substring(1);
},dasherize:function(k){return k.replace(i,"-");},titleize:function(s){s=s.toLowerCase().replace(f," ");var q=s.split(" ");var p=0;var o=q.length;var r,n,m;
u[p]=s+u[p].substring(1);}v[r]=u.join("");}return v.join("::");},underscore:function(o,p){if(p&&o===o.toUpperCase()){return o;}var l=o.split("::");var n=0;
var m=l.length;for(;n<m;n++){l[n]=l[n].replace(e,"_$1");l[n]=l[n].replace(h,"");}return l.join("/").toLowerCase();},humanize:function(m,l){m=m.toLowerCase();
m=m.replace(k,"");m=m.replace(f," ");if(!l){m=b.capitalize(m);}return m;},capitalize:function(l){l=l.toLowerCase();return l.substring(0,1).toUpperCase()+l.substring(1);
},dasherize:function(l){return l.replace(j,"-");},titleize:function(s){s=s.toLowerCase().replace(f," ");var q=s.split(" ");var p=0;var o=q.length;var r,n,m;
for(;p<o;p++){r=q[p].split("-");n=0;m=r.length;for(;n<m;n++){if(b.indexOf(c,r[n].toLowerCase())<0){r[n]=b.capitalize(r[n]);}}q[p]=r.join("-");}s=q.join(" ");
s=s.substring(0,1).toUpperCase()+s.substring(1);return s;},demodulize:function(l){var k=l.split("::");return k[k.length-1];},tableize:function(k){k=b.underscore(k);
k=b.pluralize(k);return k;},classify:function(k){k=b.camelize(k);k=b.singularize(k);return k;},foreign_key:function(l,k){l=b.demodulize(l);l=b.underscore(l)+((k)?(""):("_"))+"id";
return l;},ordinalize:function(s){var q=s.split(" ");var o=0;var n=q.length;for(;o<n;o++){var m=parseInt(q[o],10);if(!isNaN(m)){var r=q[o].substring(q[o].length-2);
s=s.substring(0,1).toUpperCase()+s.substring(1);return s;},demodulize:function(m){var l=m.split("::");return l[l.length-1];},tableize:function(l){l=b.underscore(l);
l=b.pluralize(l);return l;},classify:function(l){l=b.camelize(l);l=b.singularize(l);return l;},foreign_key:function(m,l){m=b.demodulize(m);m=b.underscore(m)+((l)?(""):("_"))+"id";
return m;},ordinalize:function(s){var q=s.split(" ");var o=0;var n=q.length;for(;o<n;o++){var m=parseInt(q[o],10);if(!isNaN(m)){var r=q[o].substring(q[o].length-2);
var p=q[o].substring(q[o].length-1);var l="th";if(r!="11"&&r!="12"&&r!="13"){if(p==="1"){l="st";}else{if(p==="2"){l="nd";}else{if(p==="3"){l="rd";}}}}q[o]+=l;
}}return q.join(" ");},transform:function(n,k){var m=0;var l=k.length;for(;m<l;m++){var o=k[m];if(this.hasOwnProperty(o)){n=this[o](n);}}return n;}};b.version="1.5.0";
}}return q.join(" ");},transform:function(o,l){var n=0;var m=l.length;for(;n<m;n++){var p=l[n];if(this.hasOwnProperty(p)){o=this[p](o);}}return o;}};b.version="1.5.1";
return b;}));

@@ -347,60 +347,128 @@ /*!

*/
var regex = {
plural : {
men : new RegExp( '^(m)en$' , 'gi' ),
people : new RegExp( '(pe)ople$' , 'gi' ),
children : new RegExp( '(child)ren$', 'gi' ),
tia : new RegExp( '([ti])a$' , 'gi' ),
analyses : new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' ),
hives : new RegExp( '(hi|ti)ves$' , 'gi' ),
curves : new RegExp( '(curve)s$' , 'gi' ),
lrves : new RegExp( '([lr])ves$' , 'gi' ),
foves : new RegExp( '([^fo])ves$' , 'gi' ),
movies : new RegExp( '(m)ovies$' , 'gi' ),
aeiouyies : new RegExp( '([^aeiouy]|qu)ies$', 'gi' ),
series : new RegExp( '(s)eries$' , 'gi' ),
xes : new RegExp( '(x|ch|ss|sh)es$' , 'gi' ),
mice : new RegExp( '([m|l])ice$' , 'gi' ),
buses : new RegExp( '(bus)es$' , 'gi' ),
oes : new RegExp( '(o)es$' , 'gi' ),
shoes : new RegExp( '(shoe)s$' , 'gi' ),
crises : new RegExp( '(cris|ax|test)es$' , 'gi' ),
octopi : new RegExp( '(octop|vir)i$' , 'gi' ),
aliases : new RegExp( '(alias|status)es$' , 'gi' ),
summonses : new RegExp( '^(summons)es$' , 'gi' ),
oxen : new RegExp( '^(ox)en' , 'gi' ),
matrices : new RegExp( '(matr)ices$' , 'gi' ),
vertices : new RegExp( '(vert|ind)ices$' , 'gi' ),
feet : new RegExp( '^feet$' , 'gi' ),
teeth : new RegExp( '^teeth$' , 'gi' ),
geese : new RegExp( '^geese$' , 'gi' ),
quizzes : new RegExp( '(quiz)zes$' , 'gi' ),
whereases : new RegExp( '^(whereas)es$' , 'gi' ),
ss : new RegExp( 'ss$' , 'gi' ),
s : new RegExp( 's$' , 'gi' )
},
singular : {
man : new RegExp( '^(m)an$' , 'gi' ),
person : new RegExp( '(pe)rson$' , 'gi' ),
child : new RegExp( '(child)$' , 'gi' ),
ox : new RegExp( '^(ox)$' , 'gi' ),
axis : new RegExp( '(ax|test)is$' , 'gi' ),
octopus : new RegExp( '(octop|vir)us$' , 'gi' ),
alias : new RegExp( '(alias|status)$' , 'gi' ),
summons : new RegExp( '^(summons)$' , 'gi' ),
bus : new RegExp( '(bu)s$' , 'gi' ),
buffalo : new RegExp( '(buffal|tomat|potat)o$', 'gi' ),
tium : new RegExp( '([ti])um$' , 'gi' ),
sis : new RegExp( 'sis$' , 'gi' ),
ffe : new RegExp( '(?:([^f])fe|([lr])f)$' , 'gi' ),
hive : new RegExp( '(hi|ti)ve$' , 'gi' ),
aeiouyy : new RegExp( '([^aeiouy]|qu)y$' , 'gi' ),
x : new RegExp( '(x|ch|ss|sh)$' , 'gi' ),
matrix : new RegExp( '(matr)ix$' , 'gi' ),
vertex : new RegExp( '(vert|ind)ex$' , 'gi' ),
mouse : new RegExp( '([m|l])ouse$' , 'gi' ),
foot : new RegExp( '^foot$' , 'gi' ),
tooth : new RegExp( '^tooth$' , 'gi' ),
goose : new RegExp( '^goose$' , 'gi' ),
quiz : new RegExp( '(quiz)$' , 'gi' ),
whereas : new RegExp( '^(whereas)$' , 'gi' ),
s : new RegExp( 's$' , 'gi' ),
common : new RegExp( '$' , 'gi' )
}
};
var plural_rules = [
// do not replace if its already a plural word
[ new RegExp( '^(m)en$' , 'gi' )],
[ new RegExp( '(pe)ople$' , 'gi' )],
[ new RegExp( '(child)ren$', 'gi' )],
[ new RegExp( '([ti])a$' , 'gi' )],
[ new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' )],
[ new RegExp( '(hi|ti)ves$' , 'gi' )],
[ new RegExp( '(curve)s$' , 'gi' )],
[ new RegExp( '([lr])ves$' , 'gi' )],
[ new RegExp( '([^fo])ves$' , 'gi' )],
[ new RegExp( '([^aeiouy]|qu)ies$', 'gi' )],
[ new RegExp( '(s)eries$' , 'gi' )],
[ new RegExp( '(m)ovies$' , 'gi' )],
[ new RegExp( '(x|ch|ss|sh)es$' , 'gi' )],
[ new RegExp( '([m|l])ice$' , 'gi' )],
[ new RegExp( '(bus)es$' , 'gi' )],
[ new RegExp( '(o)es$' , 'gi' )],
[ new RegExp( '(shoe)s$' , 'gi' )],
[ new RegExp( '(cris|ax|test)es$' , 'gi' )],
[ new RegExp( '(octop|vir)i$' , 'gi' )],
[ new RegExp( '(alias|status)es$' , 'gi' )],
[ new RegExp( '^(summons)es$' , 'gi' )],
[ new RegExp( '^(ox)en' , 'gi' )],
[ new RegExp( '(vert|ind)ices$' , 'gi' )],
[ new RegExp( '(matr)ices$' , 'gi' )],
[ new RegExp( '^feet$' , 'gi' )],
[ new RegExp( '^teeth$' , 'gi' )],
[ new RegExp( '^geese$' , 'gi' )],
[ new RegExp( '(quiz)zes$' , 'gi' )],
[ regex.plural.men ],
[ regex.plural.people ],
[ regex.plural.children ],
[ regex.plural.tia ],
[ regex.plural.analyses ],
[ regex.plural.hives ],
[ regex.plural.curves ],
[ regex.plural.lrves ],
[ regex.plural.foves ],
[ regex.plural.aeiouyies ],
[ regex.plural.series ],
[ regex.plural.movies ],
[ regex.plural.xes ],
[ regex.plural.mice ],
[ regex.plural.buses ],
[ regex.plural.oes ],
[ regex.plural.shoes ],
[ regex.plural.crises ],
[ regex.plural.octopi ],
[ regex.plural.aliases ],
[ regex.plural.summonses ],
[ regex.plural.oxen ],
[ regex.plural.matrices ],
[ regex.plural.feet ],
[ regex.plural.teeth ],
[ regex.plural.geese ],
[ regex.plural.quizzes ],
[ regex.plural.whereases ],
// original rule
[ new RegExp( '^(m)an$' , 'gi' ), '$1en' ],
[ new RegExp( '(pe)rson$' , 'gi' ), '$1ople' ],
[ new RegExp( '(child)$' , 'gi' ), '$1ren' ],
[ new RegExp( '^(ox)$' , 'gi' ), '$1en' ],
[ new RegExp( '(ax|test)is$' , 'gi' ), '$1es' ],
[ new RegExp( '(octop|vir)us$' , 'gi' ), '$1i' ],
[ new RegExp( '(alias|status)$' , 'gi' ), '$1es' ],
[ new RegExp( '^(summons)$' , 'gi' ), '$1es' ],
[ new RegExp( '(bu)s$' , 'gi' ), '$1ses' ],
[ new RegExp( '(buffal|tomat|potat|volcan)o$', 'gi' ), '$1oes' ],
[ new RegExp( '([ti])um$' , 'gi' ), '$1a' ],
[ new RegExp( 'sis$' , 'gi' ), 'ses' ],
[ new RegExp( '(?:([^f])fe|([lr])f)$' , 'gi' ), '$1$2ves' ],
[ new RegExp( '(hi|ti)ve$' , 'gi' ), '$1ves' ],
[ new RegExp( '([^aeiouy]|qu)y$' , 'gi' ), '$1ies' ],
[ new RegExp( '(x|ch|ss|sh)$' , 'gi' ), '$1es' ],
[ new RegExp( '(matr|vert|ind)ix|ex$' , 'gi' ), '$1ices' ],
[ new RegExp( '([m|l])ouse$' , 'gi' ), '$1ice' ],
[ new RegExp( '^foot$' , 'gi' ), 'feet' ],
[ new RegExp( '^tooth$' , 'gi' ), 'teeth' ],
[ new RegExp( '^goose$' , 'gi' ), 'geese' ],
[ new RegExp( '(quiz)$' , 'gi' ), '$1zes' ],
[ regex.singular.man , '$1en' ],
[ regex.singular.person , '$1ople' ],
[ regex.singular.child , '$1ren' ],
[ regex.singular.ox , '$1en' ],
[ regex.singular.axis , '$1es' ],
[ regex.singular.octopus, '$1i' ],
[ regex.singular.alias , '$1es' ],
[ regex.singular.summons, '$1es' ],
[ regex.singular.bus , '$1ses' ],
[ regex.singular.buffalo, '$1oes' ],
[ regex.singular.tium , '$1a' ],
[ regex.singular.sis , 'ses' ],
[ regex.singular.ffe , '$1$2ves' ],
[ regex.singular.hive , '$1ves' ],
[ regex.singular.aeiouyy, '$1ies' ],
[ regex.singular.x , '$1es' ],
[ regex.singular.matrix , '$1ices' ],
[ regex.singular.vertex , '$1ices' ],
[ regex.singular.mouse , '$1ice' ],
[ regex.singular.foot , 'feet' ],
[ regex.singular.tooth , 'teeth' ],
[ regex.singular.goose , 'geese' ],
[ regex.singular.quiz , '$1zes' ],
[ regex.singular.whereas, '$1es' ],
[ new RegExp( 's$', 'gi' ), 's' ],
[ new RegExp( '$' , 'gi' ), 's' ]
[ regex.singular.s , 's' ],
[ regex.singular.common, 's' ]
];

@@ -415,56 +483,59 @@

// do not replace if its already a singular word
[ new RegExp( '^(m)an$' , 'gi' )],
[ new RegExp( '(pe)rson$' , 'gi' )],
[ new RegExp( '(child)$' , 'gi' )],
[ new RegExp( '^(ox)$' , 'gi' )],
[ new RegExp( '(ax|test)is$' , 'gi' )],
[ new RegExp( '(octop|vir)us$' , 'gi' )],
[ new RegExp( '(alias|status)$' , 'gi' )],
[ new RegExp( '^(summons)$' , 'gi' )],
[ new RegExp( '(bu)s$' , 'gi' )],
[ new RegExp( '(buffal|tomat|potat)o$', 'gi' )],
[ new RegExp( '([ti])um$' , 'gi' )],
[ new RegExp( 'sis$' , 'gi' )],
[ new RegExp( '(?:([^f])fe|([lr])f)$' , 'gi' )],
[ new RegExp( '(hi|ti)ve$' , 'gi' )],
[ new RegExp( '([^aeiouy]|qu)y$' , 'gi' )],
[ new RegExp( '(x|ch|ss|sh)$' , 'gi' )],
[ new RegExp( '(matr|vert|ind)ix|ex$' , 'gi' )],
[ new RegExp( '([m|l])ouse$' , 'gi' )],
[ new RegExp( '^foot$' , 'gi' )],
[ new RegExp( '^tooth$' , 'gi' )],
[ new RegExp( '^goose$' , 'gi' )],
[ new RegExp( '(quiz)$' , 'gi' )],
[ regex.singular.man ],
[ regex.singular.person ],
[ regex.singular.child ],
[ regex.singular.ox ],
[ regex.singular.axis ],
[ regex.singular.octopus ],
[ regex.singular.alias ],
[ regex.singular.summons ],
[ regex.singular.bus ],
[ regex.singular.buffalo ],
[ regex.singular.tium ],
[ regex.singular.sis ],
[ regex.singular.ffe ],
[ regex.singular.hive ],
[ regex.singular.aeiouyy ],
[ regex.singular.x ],
[ regex.singular.matrix ],
[ regex.singular.mouse ],
[ regex.singular.foot ],
[ regex.singular.tooth ],
[ regex.singular.goose ],
[ regex.singular.quiz ],
[ regex.singular.whereas ],
// original rule
[ new RegExp( '^(m)en$' , 'gi' ), '$1an' ],
[ new RegExp( '(pe)ople$' , 'gi' ), '$1rson' ],
[ new RegExp( '(child)ren$', 'gi' ), '$1' ],
[ new RegExp( '([ti])a$' , 'gi' ), '$1um' ],
[ new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' ), '$1$2sis' ],
[ new RegExp( '(hi|ti)ves$' , 'gi' ), '$1ve' ],
[ new RegExp( '(curve)s$' , 'gi' ), '$1' ],
[ new RegExp( '([lr])ves$' , 'gi' ), '$1f' ],
[ new RegExp( '([^fo])ves$' , 'gi' ), '$1fe' ],
[ new RegExp( '(m)ovies$' , 'gi' ), '$1ovie' ],
[ new RegExp( '([^aeiouy]|qu)ies$', 'gi' ), '$1y' ],
[ new RegExp( '(s)eries$' , 'gi' ), '$1eries' ],
[ new RegExp( '(x|ch|ss|sh)es$' , 'gi' ), '$1' ],
[ new RegExp( '([m|l])ice$' , 'gi' ), '$1ouse' ],
[ new RegExp( '(bus)es$' , 'gi' ), '$1' ],
[ new RegExp( '(o)es$' , 'gi' ), '$1' ],
[ new RegExp( '(shoe)s$' , 'gi' ), '$1' ],
[ new RegExp( '(cris|ax|test)es$' , 'gi' ), '$1is' ],
[ new RegExp( '(octop|vir)i$' , 'gi' ), '$1us' ],
[ new RegExp( '(alias|status)es$' , 'gi' ), '$1' ],
[ new RegExp( '^(summons)es$' , 'gi' ), '$1' ],
[ new RegExp( '^(ox)en' , 'gi' ), '$1' ],
[ new RegExp( '(vert|ind)ices$' , 'gi' ), '$1ex' ],
[ new RegExp( '(matr)ices$' , 'gi' ), '$1ix' ],
[ new RegExp( '^feet$' , 'gi' ), 'foot' ],
[ new RegExp( '^teeth$' , 'gi' ), 'tooth' ],
[ new RegExp( '^geese$' , 'gi' ), 'goose' ],
[ new RegExp( '(quiz)zes$' , 'gi' ), '$1' ],
[ new RegExp( 'ss$' , 'gi' ), 'ss' ],
[ new RegExp( 's$' , 'gi' ), '' ]
[ regex.plural.men , '$1an' ],
[ regex.plural.people , '$1rson' ],
[ regex.plural.children , '$1' ],
[ regex.plural.tia , '$1um' ],
[ regex.plural.analyses , '$1$2sis' ],
[ regex.plural.hives , '$1ve' ],
[ regex.plural.curves , '$1' ],
[ regex.plural.lrves , '$1f' ],
[ regex.plural.foves , '$1fe' ],
[ regex.plural.movies , '$1ovie' ],
[ regex.plural.aeiouyies, '$1y' ],
[ regex.plural.series , '$1eries' ],
[ regex.plural.xes , '$1' ],
[ regex.plural.mice , '$1ouse' ],
[ regex.plural.buses , '$1' ],
[ regex.plural.oes , '$1' ],
[ regex.plural.shoes , '$1' ],
[ regex.plural.crises , '$1is' ],
[ regex.plural.octopi , '$1us' ],
[ regex.plural.aliases , '$1' ],
[ regex.plural.summonses, '$1' ],
[ regex.plural.oxen , '$1' ],
[ regex.plural.matrices , '$1ix' ],
[ regex.plural.vertices , '$1ex' ],
[ regex.plural.feet , 'foot' ],
[ regex.plural.teeth , 'tooth' ],
[ regex.plural.geese , 'goose' ],
[ regex.plural.quizzes , '$1' ],
[ regex.plural.whereases, '$1' ],
[ regex.plural.ss, 'ss' ],
[ regex.plural.s , '' ]
];

@@ -779,7 +850,7 @@

/**
* This function adds dasherization support to every String object.
* This function replaces underscores with dashes in the string.
* @public
* @function
* @param {String} str The subject string.
* @returns {String} Replaces all spaces or underbars with dashes.
* @returns {String} Replaces all spaces or underscores with dashes.
* @example

@@ -1000,5 +1071,5 @@ *

*/
inflector.version = '1.5.0';
inflector.version = '1.5.1';
return inflector;
}));
{
"name" : "inflection",
"version" : "1.5.0",
"version" : "1.5.1",
"description": "A port of inflection-js to node.js module",

@@ -5,0 +5,0 @@ "keywords" : [

@@ -291,3 +291,3 @@ # inflection

This function adds dasherization support to every String object.
This function replaces underscores with dashes in the string.

@@ -294,0 +294,0 @@ #### Arguments

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