kbrabrand / camelize-ts

A typescript typed camelCase function that recursively camel cases a snake cased object structure
25 stars 6 forks source link

Non-recursive version #42

Closed tonyxiao closed 1 year ago

tonyxiao commented 1 year ago

Can we also support a non-recursive version of this? The use case is I'd like to transform database field names without transforming jsonb objects stored inside them.

jonkoops commented 1 year ago

Perhaps it would be possible to add a depth parameter to accomplish this. Feel free to open up a PR if you have some ideas.

kbrabrand commented 1 year ago

I have been thinking about this over the weekend, and was thinking of use cases. I was leaning towards doing it either shallowly (first level only) or recursive all the way down. Do you see a use case for doing N levels down, where N is some number between 1 and the depth of the structure you're transformin, @tonyxiao?

tonyxiao commented 1 year ago

I think either fully shallow or fully deep should be sufficient. Can typing even handle n level down?

kbrabrand commented 1 year ago

[...] Can typing even handle n level down?

It would be tricky for sure, but whether or not it's possible is something I'd have to investigate closer to answer..

kbrabrand commented 1 year ago

@tonyxiao & @jonkoops: see #43. Thoughts?

tonyxiao commented 1 year ago

Looks great!

kbrabrand commented 1 year ago

@tonyxiao A new release is out.