Created
November 25, 2020 16:05
-
-
Save colmjude/25c0170399d4b9a4673c32d1c0908b63 to your computer and use it in GitHub Desktop.
Javascript function to convert strings to camel case strings
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 camelCaseReplacer(match, s) { | |
return s.toUpperCase() | |
} | |
function toCamelCase(s) { | |
return s.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, camelCaseReplacer) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment