array-string-to-nested-structure
v1.0.12
Published
Convert array of string to nested structure
Downloads
30
Readme
Convert array of strings to nested structure
const input = [
"payments",
"effects",
"items.product.unit",
"items.effects",
"items.tax",
];
const output = [
{ name: "payments" },
{ name: "effects" },
{
name: "items",
children: [
{ name: "product", children: [{ name: "unit" }] },
{ name: "effects" },
{ name: "tax" },
],
},
];