@retrohacker/objectify
v2.0.0
Published
Recursively convert an object with arrays to an object with objects
Downloads
11
Readme
objectify
A little library that recursively converts an object with arrays to an object with objects.
Install
yarn add @retrohacker/objectify
Usage
objectify({
'foo': [
{ 'a': 1 },
{ 'b': 2 }]
}
)
yields
{
'foo': {
'foo_0': { 'a': 1 },
'foo_1': { 'b': 2 }
}
}
and
{
'foo': [1, 2, 3],
'bar': ['a', 'b', 'c']
}
yields
{
'foo': [1, 2, 3],
'bar': ['a', 'b', 'c']
}