Skip to content

Instantly share code, notes, and snippets.

@therebelrobot
Created March 26, 2014 16:21
Show Gist options
  • Save therebelrobot/9787170 to your computer and use it in GitHub Desktop.
Save therebelrobot/9787170 to your computer and use it in GitHub Desktop.
Simple function to convert string to CamelCase
/* http://stackoverflow.com/questions/10425287/convert-string-to-camelcase-with-regular-expression */
/* http://jsfiddle.net/54ZcM/ */
function camelCase(string) {
return string.toLowerCase().replace(/(\-[a-zA-Z])/g, function($1) {
return $1.toUpperCase().replace('-','');
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment