ascii-tree-array
v0.1.1
Published
Create ascii text trees from multidimensional arrays
Downloads
3
Readme
ascii-tree-array
Create ascii text trees from multidimensional arrays
Installation
$ npm install --save ascii-tree-array
Usage
const asciiTree = require('ascii-tree-array')
const data = [
'foo',
[
'bar',
'baz',
[
'qux',
'qui'
]
]
]
asciiTree.list(data)
// => #foo\r\n##bar\r\n##baz\r\n###qux\r\n###qui
asciiTree.tree(data)
// =>
foo
├─ bar
└─ baz
├─ qux
└─ qui
API
asciiTree.tree(array)
=> **Returns** `String`
When passing in an array, there should be only one value that is to be your root. For example:
[
'home',
[
'sean'
]
]
is allowed. However,
[
'home',
'sean',
[
'projects'
]
]
is not. This is because there can only be a single root to the tree.
asciiTree.list(array)
=> Returns String
This will return a raw bullet list of your array.
License
MIT © Sean Wilson