nest-deep
v1.3.4
Published
A utility library to convert between nested and flattened objects.
Downloads
967
Maintainers
Readme
nest-deep
Usage
import { nested, flatten } from 'nest-deep';
nested({
'a.b': 1,
'c.d[0][0]': 1,
'c.d[1]': 5,
'c.d[2]': 12,
});
flatten({
a: {
b: 1,
},
c: {
d: [[1], 5, 12],
},
});
Output
nested
{
"a": {
"b": 1
},
"c": {
"d": [[1], 5, 12]
}
}
flatten
{
"a.b": 1,
"c.d[0][0]": 1,
"c.d[1]": 5,
"c.d[2]": 12
}