Last active
December 30, 2017 10:41
-
-
Save dalibormesaric/7feaf8f3a01ce305f50e to your computer and use it in GitHub Desktop.
Convert hyphens to camel case and convert camel case to hyphens
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
("thisIsTest").replace(/([a-z][A-Z])/g, function (g) { return g[0] + '-' + g[1].toLowerCase() }); | |
"this-is-test" | |
("this-is-test").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); | |
"thisIsTest" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment