Created
November 8, 2020 03:12
-
-
Save celsobessa/c4841c860dec8e59f0f0d5bc81e311eb to your computer and use it in GitHub Desktop.
Convert hyphens 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
function camelize(str) { | |
const camelizeRE = /-(\w)/g; | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment