inflection
Advanced tools
Comparing version 1.3.7 to 1.3.8
{ | ||
"name": "inflection", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"homepage": "https://github.com/dreamerslab/node.inflection", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript Inflection Support", |
{ | ||
"name": "inflection", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"repo": "dreamerslab/node.inflection", | ||
@@ -5,0 +5,0 @@ "description": "A port of inflection-js to node.js module", |
# History | ||
## 1.3.8 / 2014-07-03 | ||
- [others] syntax tuning | ||
## 1.3.7 / 2014-06-25 | ||
@@ -9,2 +14,3 @@ | ||
## 1.3.6 / 2014-06-07 | ||
@@ -11,0 +17,0 @@ |
@@ -16,8 +16,8 @@ /*! | ||
}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,p,o,q){if(!o){o=-1;}var m=-1;var n=o;var l=k.length;for(;n<l;n++){if(k[n]===p||q&&q(k[n],p)){m=n;break;}}return m; | ||
},pluralize:function(l,k){return b._apply_rules(l,g,d,k);},singularize:function(l,k){return b._apply_rules(l,a,d,k);},camelize:function(t,m){var v=t.split("/"); | ||
var r=0;var q=v.length;var u,n,p,o,s;for(;r<q;r++){u=v[r].split("_");p=0;o=u.length;for(;p<o;p++){if(p!==0){u[p]=u[p].toLowerCase();}s=u[p].charAt(0);s=m&&r===0&&p===0?s.toLowerCase():s.toUpperCase(); | ||
}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);},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(k,l){k=k.toLowerCase(); | ||
k=k.replace(j,"");k=k.replace(f," ");if(!l){k=b.capitalize(k);}return k;},capitalize:function(k){k=k.toLowerCase();return k.substring(0,1).toUpperCase()+k.substring(1); | ||
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; | ||
@@ -29,3 +29,3 @@ 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(" "); | ||
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.3.7"; | ||
return b;})); | ||
}}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.3.8"; | ||
return b;})); |
@@ -177,3 +177,3 @@ /*! | ||
*/ | ||
_apply_rules : function( str, rules, skip, override ){ | ||
_apply_rules : function ( str, rules, skip, override ){ | ||
if( override ){ | ||
@@ -210,4 +210,4 @@ str = override; | ||
* @param {Object} item Object to locate in the Array. | ||
* @param {Number} fromIndex Starts checking from this position in the Array.(optional) | ||
* @param {Function} compareFunc Function used to compare Array item vs passed item.(optional) | ||
* @param {Number} from_index Starts checking from this position in the Array.(optional) | ||
* @param {Function} compare_func Function used to compare Array item vs passed item.(optional) | ||
* @returns {Number} Return index position in the Array of the passed item. | ||
@@ -221,13 +221,13 @@ * @example | ||
*/ | ||
indexOf : function( arr, item, fromIndex, compareFunc ){ | ||
if( !fromIndex ){ | ||
fromIndex = -1; | ||
indexOf : function ( arr, item, from_index, compare_func ){ | ||
if( !from_index ){ | ||
from_index = -1; | ||
} | ||
var index = -1; | ||
var i = fromIndex; | ||
var i = from_index; | ||
var j = arr.length; | ||
for( ; i < j; i++ ){ | ||
if( arr[ i ] === item || compareFunc && compareFunc( arr[ i ], item )){ | ||
if( arr[ i ] === item || compare_func && compare_func( arr[ i ], item )){ | ||
index = i; | ||
@@ -292,3 +292,3 @@ break; | ||
* @param {String} str The subject string. | ||
* @param {Boolean} lowFirstLetter Default is to capitalize the first letter of the results.(optional) | ||
* @param {Boolean} low_first_letter Default is to capitalize the first letter of the results.(optional) | ||
* Passing true will lowercase it. | ||
@@ -304,3 +304,3 @@ * @returns {String} Lower case underscored words will be returned in camel case. | ||
*/ | ||
camelize : function ( str, lowFirstLetter ){ | ||
camelize : function ( str, low_first_letter ){ | ||
var str_path = str.split( '/' ); | ||
@@ -322,3 +322,3 @@ var i = 0; | ||
first = str_arr[ k ].charAt( 0 ); | ||
first = lowFirstLetter && i === 0 && k === 0 | ||
first = low_first_letter && i === 0 && k === 0 | ||
? first.toLowerCase() : first.toUpperCase(); | ||
@@ -341,3 +341,3 @@ str_arr[ k ] = first + str_arr[ k ].substring( 1 ); | ||
* @param {String} str The subject string. | ||
* @param {Boolean} allUpperCase Default is to lowercase and add underscore prefix.(optional) | ||
* @param {Boolean} all_upper_case Default is to lowercase and add underscore prefix.(optional) | ||
* Passing true will return as entered. | ||
@@ -354,4 +354,4 @@ * @returns {String} Camel cased words are returned as lower cased and underscored. | ||
*/ | ||
underscore : function ( str, allUpperCase ){ | ||
if( allUpperCase && str === str.toUpperCase()) return str; | ||
underscore : function ( str, all_upper_case ){ | ||
if( all_upper_case && str === str.toUpperCase()) return str; | ||
@@ -377,3 +377,3 @@ var str_path = str.split( '::' ); | ||
* @param {String} str The subject string. | ||
* @param {Boolean} lowFirstLetter Default is to capitalize the first letter of the results.(optional) | ||
* @param {Boolean} low_first_letter Default is to capitalize the first letter of the results.(optional) | ||
* Passing true will lowercase it. | ||
@@ -388,3 +388,3 @@ * @returns {String} Lower case underscored words will be returned in humanized form. | ||
*/ | ||
humanize : function( str, lowFirstLetter ){ | ||
humanize : function ( str, low_first_letter ){ | ||
str = str.toLowerCase(); | ||
@@ -394,3 +394,3 @@ str = str.replace( id_suffix, '' ); | ||
if( !lowFirstLetter ){ | ||
if( !low_first_letter ){ | ||
str = inflector.capitalize( str ); | ||
@@ -553,3 +553,3 @@ } | ||
* @param {String} str The subject string. | ||
* @param {Boolean} dropIdUbar Default is to seperate id with an underbar at the end of the class name, | ||
* @param {Boolean} drop_id_ubar Default is to seperate id with an underbar at the end of the class name, | ||
you can pass true to skip it.(optional) | ||
@@ -564,5 +564,5 @@ * @returns {String} Underscored plural nouns become the camel cased singular form. | ||
*/ | ||
foreign_key : function( str, dropIdUbar ){ | ||
foreign_key : function ( str, drop_id_ubar ){ | ||
str = inflector.demodulize( str ); | ||
str = inflector.underscore( str ) + (( dropIdUbar ) ? ( '' ) : ( '_' )) + 'id'; | ||
str = inflector.underscore( str ) + (( drop_id_ubar ) ? ( '' ) : ( '_' )) + 'id'; | ||
@@ -648,5 +648,5 @@ return str; | ||
*/ | ||
inflector.version = '1.3.7'; | ||
inflector.version = '1.3.8'; | ||
return inflector; | ||
})); |
{ | ||
"name" : "inflection", | ||
"version" : "1.3.7", | ||
"version" : "1.3.8", | ||
"description": "A port of inflection-js to node.js module", | ||
@@ -5,0 +5,0 @@ "keywords" : [ |
@@ -18,2 +18,8 @@ # inflection | ||
## Angular Support | ||
Checkout [ngInflection](https://github.com/konsumer/ngInflection) from [konsumer](https://github.com/konsumer) | ||
## Installation | ||
@@ -29,8 +35,8 @@ | ||
- inflection.indexOf( arr, item, fromIndex, compareFunc ); | ||
- inflection.indexOf( arr, item, from_index, compare_func ); | ||
- inflection.pluralize( str, plural ); | ||
- inflection.singularize( str, singular ); | ||
- inflection.camelize( str, lowFirstLetter ); | ||
- inflection.underscore( str, allUpperCase ); | ||
- inflection.humanize( str, lowFirstLetter ); | ||
- inflection.camelize( str, low_first_letter ); | ||
- inflection.underscore( str, all_upper_case ); | ||
- inflection.humanize( str, low_first_letter ); | ||
- inflection.capitalize( str ); | ||
@@ -42,3 +48,3 @@ - inflection.dasherize( str ); | ||
- inflection.classify( str ); | ||
- inflection.foreign_key( str, dropIdUbar ); | ||
- inflection.foreign_key( str, drop_id_ubar ); | ||
- inflection.ordinalize( str ); | ||
@@ -57,3 +63,3 @@ - inflection.transform( str, arr ); | ||
### inflection.indexOf( arr, item, fromIndex, compareFunc ); | ||
### inflection.indexOf( arr, item, from_index, compare_func ); | ||
@@ -74,3 +80,3 @@ This lets us detect if an Array contains a given element. | ||
> fromIndex | ||
> from_index | ||
@@ -80,3 +86,3 @@ type: Number | ||
> compareFunc | ||
> compare_func | ||
@@ -149,3 +155,3 @@ type: Function | ||
### inflection.camelize( str, lowFirstLetter ); | ||
### inflection.camelize( str, low_first_letter ); | ||
@@ -161,3 +167,3 @@ This function adds camelization support to every String object. | ||
> lowFirstLetter | ||
> low_first_letter | ||
@@ -176,3 +182,3 @@ type: Boolean | ||
### inflection.underscore( str, allUpperCase ); | ||
### inflection.underscore( str, all_upper_case ); | ||
@@ -188,3 +194,3 @@ This function adds underscore support to every String object. | ||
> allUpperCase | ||
> all_upper_case | ||
@@ -207,3 +213,3 @@ type: Boolean | ||
### inflection.humanize( str, lowFirstLetter ); | ||
### inflection.humanize( str, low_first_letter ); | ||
@@ -219,3 +225,3 @@ This function adds humanize support to every String object. | ||
> lowFirstLetter | ||
> low_first_letter | ||
@@ -351,3 +357,3 @@ type: Boolean | ||
### inflection.foreign_key( str, dropIdUbar ); | ||
### inflection.foreign_key( str, drop_id_ubar ); | ||
@@ -363,3 +369,3 @@ This function adds foreign key support to every String object. | ||
> lowFirstLetter | ||
> low_first_letter | ||
@@ -366,0 +372,0 @@ type: Boolean |
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
44156
450
664