Created
February 20, 2019 15:22
-
-
Save HuangXiZhou/caca634ac92f9f88aeaf604ef0924cc7 to your computer and use it in GitHub Desktop.
toUnderscore
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 toUnderscore(string) { | |
return string.toString().split(/(?=[A-Z])/).join('_').toLowerCase(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment