Created
October 21, 2017 13:49
-
-
Save c01nd01r/729a293df2a84fc6920fa0e395769938 to your computer and use it in GitHub Desktop.
Hyphenate a camelCase string. (Vue.js)
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
/** | |
* Hyphenate a camelCase string. | |
*/ | |
var hyphenateRE = /\B([A-Z])/g; | |
var hyphenate = function(str) { | |
return str.replace(hyphenateRE, '-$1').toLowerCase() | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment