Skip to content

Instantly share code, notes, and snippets.

@tracend
Last active December 17, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tracend/5530356 to your computer and use it in GitHub Desktop.
Save tracend/5530356 to your computer and use it in GitHub Desktop.
Underscore Mixin: camelCase() The opposite of toDash()... #underscore #cc
// Underscore Mixin: camelCase()
// Source: https://gist.github.com/tracend/5530356
// Based on: http://stackoverflow.com/a/6661012
_.mixin({
/* Convert Dashed to CamelCase */
camelCase : function( string ){
return string.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment