lodash-contrib
Advanced tools
Comparing version 2.4.1 to 241.1.0
@@ -5,3 +5,3 @@ // lodash-contrib (lodash.util.strings.js 0.0.1) | ||
(function(root) { | ||
(function (root) { | ||
@@ -22,3 +22,3 @@ // Baseline setup | ||
// Explodes a string into an array of chars | ||
explode: function(s) { | ||
explode: function (s) { | ||
return s.split(''); | ||
@@ -28,3 +28,3 @@ }, | ||
// Implodes and array of chars into a string | ||
implode: function(a) { | ||
implode: function (a) { | ||
return a.join(''); | ||
@@ -34,17 +34,31 @@ }, | ||
// Converts a string to camel case | ||
camelCase : function( string ){ | ||
return string.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); | ||
camelCase: function (string) { | ||
return string.replace(/-([a-z])/g, function (g) { | ||
return g[1].toUpperCase(); | ||
}); | ||
}, | ||
// Converts camel case to dashed (opposite of _.camelCase) | ||
toDash : function( string ){ | ||
string = string.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}); | ||
toDash: function (string) { | ||
string = string.replace(/([A-Z])/g, function ($1) { | ||
return "-" + $1.toLowerCase(); | ||
}); | ||
// remove first dash | ||
return ( string.charAt( 0 ) == '-' ) ? string.substr(1) : string; | ||
return ( string.charAt(0) == '-' ) ? string.substr(1) : string; | ||
}, | ||
// Reports whether a string contains a search string. | ||
strContains: function(str, search) { | ||
strContains: function (str, search) { | ||
if (typeof str != 'string') throw new TypeError; | ||
return (str.indexOf(search) != -1); | ||
}, | ||
// Reports whether a string contains a search string. | ||
capitalize: function capitalize(string) { | ||
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); | ||
}, | ||
// Slugify a string. Makes lowercase, and converts dots and spaces to dashes. | ||
slugify: function (urlString) { | ||
return urlString.replace(/ /g, '-').replace(/\./, '').toLowerCase(); | ||
} | ||
@@ -51,0 +65,0 @@ |
{ | ||
"name": "lodash-contrib", | ||
"version": "2.4.1", | ||
"version": "241.1.0", | ||
"main": "index.js", | ||
@@ -26,8 +26,10 @@ "devDependencies": { | ||
}, | ||
"contributors": [{ | ||
"contributors": [ | ||
{ | ||
"name": "Refael Ackermann", | ||
"email": "refael@empeeric.com", | ||
"url": "http://www.empeeric.com/" | ||
}], | ||
} | ||
], | ||
"homepage": "https://github.com/Empeeric/lodash-contrib" | ||
} |
1017855
27933