Open mxl opened 7 years ago
@hughsk WDYT if I'll prepare such PR?
I need the camel case option as well. We need this functionality for better customisation of key names than a simple separator!
There is a snake case variant here
I complete rewrote flat as flat2
Includes loads of customisation options for custom key generation and transforms to fit any such scenario. Now snakecase
and camelCase
options come built in as well ;)
@mxl how would you handle the case where the object looks like so?
{
first: {
second: "hello",
fOurth: "foo"
}
}
Now you have the key-value pair
firstFOurth: "foo"
How will this be unflattened? Or, how will you determine whether or not this is first.fOurth
or first.f.ourth
?
Proposal
Support passing
(string, string) => string
function as a delimiter option.For example, for object:
and
delimiter
:it will produce camel case names: