Skip to content

Instantly share code, notes, and snippets.

@blizzrdof77
Forked from youssman/dash-to-camelCase.js
Last active January 4, 2018 19:15
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 blizzrdof77/73c746b918ef554794c681a96c12a022 to your computer and use it in GitHub Desktop.
Save blizzrdof77/73c746b918ef554794c681a96c12a022 to your computer and use it in GitHub Desktop.
Javascript convert dash (hyphen) to camelcase
/**
* Convert string with dashes to camel case
*
* @return String
*/
String.prototype.dashToCamelCase = function() {
return this.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