function toCamelCase(str) { return str .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); }) .replace(/\s/g, '') .replace(/^(.)/, function($1) { return $1.toLowerCase(); }); } //https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case