array-string-to-nested-structure
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

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" },
    ],
  },
];

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i array-string-to-nested-structure

    Weekly Downloads

    4

    Version

    1.0.12

    License

    MIT

    Unpacked Size

    7.05 kB

    Total Files

    11

    Last publish

    Collaborators

    • miklas_pawel