ramda-extension icon indicating copy to clipboard operation
ramda-extension copied to clipboard

toSnakeCase function is broken when converting from camelCase

Open dphaener opened this issue 4 years ago • 5 comments

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

dphaener avatar Dec 02 '19 19:12 dphaener

woking on it

tommmyy avatar Dec 03 '19 09:12 tommmyy

Any updates?

carina-akaia avatar Oct 18 '20 01:10 carina-akaia

@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. ;)

dphaener avatar Oct 27 '20 17:10 dphaener

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

carina-akaia avatar Oct 28 '20 08:10 carina-akaia

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.

craineum avatar Sep 22 '21 13:09 craineum