Created
November 25, 2016 09:35
-
-
Save iolo/e31b42c8fbe66766652590243b87b840 to your computer and use it in GitHub Desktop.
convert snake case(underscore or dash separated) string into camel case
This file contains hidden or 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
var SNAKE_CASE_REGEXP = /[_-]([a-z])/g; | |
function toCamelCase(str) { | |
return String(str) | |
.replace(SNAKECASE_REGEXP, function (match, match1) { | |
return match1.toUpperCase(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment