Transform strings between snake, camel, and upper camel case.
thisIsACamelCasedVariable). Firebase, however, sent all their JSON keys in snake case (
this_is_a_snake_cased_variable), while Twilio sent all of their JSON keys in upper camel case (
To make matters worse, my ESlint config enforced camel casing and I didn't want to change it! Instead, I wrote a couple of tools to solve the issue:
transform-string-case, you need to pass it a string, what case the string is starting as, and what case the string is being transformed to:
// 'camel_case_string'// 'SnakeCaseString'// 'upper_camel_case_string'
transform-string-case has a default export, as well as a couple of named helper exports (
lowercaseFirstCharacter). these helpers are used internally by the
transformStringCase, but they are exposed for convenience.
// or// 'Hello world!'// 'hello World!'// '😁ello World!'
If you want to contribute, make sure to check out our contributing guide!
💻 📖 🤔 🚇 🚧 🔧 ⚠️