@javagt/array-to-tree

1.0.1 • Public • Published

Small packages that converts a collection of array-based routes to a file-tree format.

import toTree from "@javagt/array-to-tree";
console.log(
  toTree([
    ["foo", "bar.txt"],
    ["foo", "rab.txt"],
    ["foo", "baz", "other.txt"],
  ])
);

/*
<ref *1> {
  type: 'directory',
  children: {
    foo: {
      name: 'foo',
      route: [Array],
      type: 'directory',
      children: [Object],
      parent: [Circular *1]
    }
  }
*/

Readme

Keywords

none

Package Sidebar

Install

npm i @javagt/array-to-tree

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

2.37 kB

Total Files

4

Last publish

Collaborators

  • javagt