inflection
Advanced tools
Comparing version 1.13.1 to 1.13.2
# History | ||
## 1.13.2 / 2022-01-29 | ||
- [fix] `drives` singular form | ||
- [feat] allow `inflect` to use floats | ||
- [chore] upgrade packages | ||
## 1.13.1 / 2021-05-21 | ||
@@ -4,0 +10,0 @@ |
@@ -355,2 +355,3 @@ /*! | ||
analyses : new RegExp( '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi' ), | ||
drives : new RegExp( '(drive)s$' , 'gi' ), | ||
hives : new RegExp( '(hi|ti)ves$' , 'gi' ), | ||
@@ -391,2 +392,3 @@ curves : new RegExp( '(curve)s$' , 'gi' ), | ||
child : new RegExp( '(child)$' , 'gi' ), | ||
drive : new RegExp( '(drive)$' , 'gi' ), | ||
ox : new RegExp( '^(ox)$' , 'gi' ), | ||
@@ -428,2 +430,3 @@ axis : new RegExp( '(ax|test)is$' , 'gi' ), | ||
[ regex.plural.analyses ], | ||
[ regex.plural.drives ], | ||
[ regex.plural.hives ], | ||
@@ -459,2 +462,3 @@ [ regex.plural.curves ], | ||
[ regex.singular.child , '$1ren' ], | ||
[ regex.singular.drive , '$1s' ], | ||
[ regex.singular.ox , '$1en' ], | ||
@@ -498,2 +502,3 @@ [ regex.singular.axis , '$1es' ], | ||
[ regex.singular.child ], | ||
[ regex.singular.drive ], | ||
[ regex.singular.ox ], | ||
@@ -526,2 +531,3 @@ [ regex.singular.axis ], | ||
[ regex.plural.children , '$1' ], | ||
[ regex.plural.drives , '$1'], | ||
[ regex.plural.genera , 'genus'], | ||
@@ -702,3 +708,3 @@ [ regex.plural.criteria , '$1on'], | ||
/** | ||
* This function will pluralize or singularlize a String appropriately based on an integer value | ||
* This function will pluralize or singularlize a String appropriately based on a number value | ||
* @public | ||
@@ -719,2 +725,3 @@ * @function | ||
* inflection.inflect( 'guys', 1 , 'person' ); // === 'person' | ||
* inflection.inflect( 'inches', 1.5 ); // === 'inches' | ||
* inflection.inflect( 'person', 2 ); // === 'people' | ||
@@ -726,10 +733,10 @@ * inflection.inflect( 'octopus', 2 ); // === 'octopuses' | ||
inflect : function ( str, count, singular, plural ){ | ||
count = parseInt( count, 10 ); | ||
count = parseFloat( count, 10 ); | ||
if( isNaN( count )) return str; | ||
if( count === 0 || count > 1 ){ | ||
if( count === 1 ){ | ||
return inflector._apply_rules( str, singular_rules, uncountable_words, singular ); | ||
}else{ | ||
return inflector._apply_rules( str, plural_rules, uncountable_words, plural ); | ||
}else{ | ||
return inflector._apply_rules( str, singular_rules, uncountable_words, singular ); | ||
} | ||
@@ -736,0 +743,0 @@ }, |
{ | ||
"name": "inflection", | ||
"version": "1.13.1", | ||
"version": "1.13.2", | ||
"description": "A port of inflection-js to node.js module", | ||
@@ -91,5 +91,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"mocha": "^8.3.2", | ||
"mocha": "^9.2.0", | ||
"should": "^13.2.3", | ||
"terser": "^5.7.0" | ||
"terser": "^5.10.0" | ||
}, | ||
@@ -96,0 +96,0 @@ "main": "./lib/inflection.js", |
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
49638
6
970