tommmyy / ramda-extension

🤘Utility library for functional JavaScript. With ❤️ to Ramda.
https://ramda-extension.web.app/
Apache License 2.0
167 stars 24 forks source link

toSnakeCase function is broken when converting from camelCase #169

Open dphaener opened 4 years ago

dphaener commented 4 years ago

Describe the bug Using the snake case function on a camel cased string does not properly convert the string:

> R_.toSnakeCase('fooBar') //=> 'foobar'

To Reproduce https://ramda-extension.firebaseapp.com/repl/?v=%5E0.26.1&ve=0.10.1#?R_.toSnakeCase%28%27fooBar%27%29

Expected behavior It should properly convert the string:

> R_.toSnakeCase('fooBar') //=> 'foo_bar'

Additional context N/A

tommmyy commented 4 years ago

woking on it

carina-akaia commented 4 years ago

Any updates?

dphaener commented 4 years ago

@KarinaDrummer @tommmyy Finally got around to addressing this: https://github.com/tommmyy/ramda-extension/pull/182. :) Open to discussion on the implementation and potential edge cases here. That regex was tricky to put together. ;)

carina-akaia commented 4 years ago

Cool, hope I'll have a time to join the discussion

craineum commented 3 years ago

Any update on when this might get merged/fixed? Thanks :)

Also, another handy thing would be to have the compliment of camelizeKeys so snakeCaseKeys or snakizeKeys. Having these two things would make it easy for talking to backends that do snake case. Can open another issue if there is interest in that.