console-log-tree
v1.2.1
Published
Log the tree of array or object
Downloads
7,313
Readme
console-log-tree
Log the tree of an array or object
Example
Input
[
{
"name": "photos",
"children": [
{
"name": "summer",
"children": [
{
"name": "june",
"children": [
{
"name": "windsurf.jpg",
}
]
}
]
},
{
"name": "winter",
"children": [
{
"name": "january",
"children": [
{
"name": "ski.png",
},
{
"name": "snowboard.jpg",
}
]
}
]
}
]
},
{
"name":'doc'
}
]
Output
├── photos
│ ├── summer
│ │ └── june
│ │ └── windsurf.jpg
│ └── winter
│ └── january
│ ├── ski.png
│ └── snowboard.jpg
└── doc
Use
npm install console-log-tree
const logTree = require('console-log-tree')
const tree = {...}
const treeStr = logTree.parse(tree)
console.log(treeStr)
// OR
logTree.log(tree)