-
-
Save blizzrdof77/73c746b918ef554794c681a96c12a022 to your computer and use it in GitHub Desktop.
Javascript convert dash (hyphen) to camelcase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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