1.0.1 • Published 3 years ago

@javagt/array-to-tree v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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]
    }
  }
*/