Created
March 11, 2022 10:09
-
-
Save AitorAlejandro/2789ebe294ab358b564e6c3ae0a64915 to your computer and use it in GitHub Desktop.
Converts a snake string to camel 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
const snakeToCamel = (s: string): string => s.toLowerCase().replace(/(_\w)/g, (w) => w.toUpperCase().substring(1)); | |
snakeToCamel('foo_bar'); // -> fooBar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment