Created
April 30, 2018 06:33
-
-
Save stbaer/129ca88f19212f12369d6e1212e5a60c to your computer and use it in GitHub Desktop.
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
export default str => str | |
.replace(/^[_.\- ]+/, '') | |
.toLowerCase() | |
.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment