1.1.9 • Published 7 months ago

treeify-data v1.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

treeify-data

treeify-data converts a JS object into a nice, visible depth-indented tree for console printing. The structure generated is similar to what you get by running the tree command on Unixy platforms.

Usage

First you'll want to run this command in your project's root folder:

$ npm install treeify-data

Then proceed to use it in your project:

import treeifyData from "treeify-data";
console.log(
  treeifyData({
    name: 1,                          // 1
    items: [{ name: 2,                // └─  2
                items: [ { name: 3 }, //    ├─ 3
                         { name: 4 }] //    └─ 4
            }]
});
PropDescriptionDefaultType
propUsed to indicate data outputnamestring
childrenPropUsed to specify properties of child elementsitemsstring

Example:

import treeifyData from "treeify-data";
console.log(
  treeifyData({
    parent: 1,                           // 1
    childs: [{ parent: 2,                // └─  2
               childs: [ { parent: 3 },  //    ├─ 3
                       { parent: 4 }]    //    └─ 4
            }]
}, 'parent', 'childs');
1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.2.5

7 months ago

1.1.5

7 months ago

1.2.4

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago