Created
June 15, 2016 13:39
-
-
Save serslon/1860d715663289f658f7640d1d7ad28f to your computer and use it in GitHub Desktop.
Convert string from downdash or dash to camelCase string
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
| string.toLowerCase().replace(/[-_]+(.)?/g, (match, group) => group ? group.toUpperCase() : '') | |
| /* | |
| Incoming string like Data_Example-string out string dataExampleString | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment