Skip to content

Instantly share code, notes, and snippets.

@edinella
Created April 7, 2013 23:11
Show Gist options
  • Select an option

  • Save edinella/5333007 to your computer and use it in GitHub Desktop.

Select an option

Save edinella/5333007 to your computer and use it in GitHub Desktop.
Converts a space separated string to camel case
function toCamelCase(str) {
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment