tenderizer
v0.0.8
Published
Slice a deep object into multiple shallow objects
Downloads
17
Maintainers
Readme
Slice a deep object into multiple shallow objects.
Installation
npm i tenderizer
Usage
import { tenderize } from "tenderizer";
expect(
tenderize({
a: 1,
b: [2, 3],
c: [
{ d: 4, e: 5 },
{ d: 6, e: 7 },
{ d: 8, e: 9 },
],
f: [
{ g: { i: 10, j: 11 }, h: { i: 12, j: 13 } },
{ g: { i: 14, j: 15 }, h: { i: 16, j: 17 } },
],
k: {
l: {
m: 18,
n: {
o: 19,
p: 20,
},
},
},
})
).toStrictEqual([
{
a: 1,
b: 2,
"c.d": 4,
"c.e": 5,
"f.g.i": 10,
"f.g.j": 11,
"f.h.i": 12,
"f.h.j": 13,
"k.l.m": 18,
"k.l.n.o": 19,
"k.l.n.p": 20,
},
{
b: 3,
"c.d": 6,
"c.e": 7,
"f.g.i": 14,
"f.g.j": 15,
"f.h.i": 16,
"f.h.j": 17,
},
{ "c.d": 8, "c.e": 9 },
]);