Created
April 17, 2017 06:28
-
-
Save qzm/b0a373702174c76aacee37bd4600178e to your computer and use it in GitHub Desktop.
Camelize a hyphen-delimited 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
/** | |
* Camelize a hyphen-delimited string. | |
*/ | |
var camelizeRE = /-(\w)/g; | |
var camelize = cached(function (str) { | |
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment