function snakeToCamel(s){
return s.replace(/(\-\w)/g, function(m){return m[1].toUpperCase();});
}
or as more readable codevar snakeCaseString = 'lorem-ipsum';
var find = /(\-\w)/g;
var convert = function(matches){
return matches[1].toUpperCase();
};
var camelCaseString = snakeCaseString.replace(
find,
convert
);