anorgatarrak-wordpress-theme/node_modules/underscore.string/camelize.js

15 lines
321 B
JavaScript

var trim = require('./trim');
var decap = require('./decapitalize');
module.exports = function camelize(str, decapitalize) {
str = trim(str).replace(/[-_\s]+(.)?/g, function(match, c) {
return c ? c.toUpperCase() : "";
});
if (decapitalize === true) {
return decap(str);
} else {
return str;
}
};