Skip to content

rjoydip-zz/array-treefy

Repository files navigation

array-treefy Build Status

Display array in tree view

Install globally

$ npm i -g array-treefy

Install locally

$ npm i --save array-treefy

Use Programmatically

const arrayTreefy = require("array-treefy")
arrayTree([1, 2, [3, 4, 5], 6, 7], "x0")

Global usage

$ array-treefy "[1,2, [3,4], 5, [6, [7,8], 9], 10]" --label="xo"

Output

xo
├── 1
├── 2
├─┬ xo
│ ├── 3
│ └── 4
├── 5
├─┬ xo
│ ├── 6
│ ├─┬ xo
│ │ ├── 7
│ │ └── 8
│ └── 9
└── 10

API

arrayTreefy(data [, label])

Returns a string.

data

Type: Array

label

Type: string
Default: --

License

MIT © Joydip Roy (rjoydip)

Releases

No releases published

Sponsor this project

Packages

No packages published