Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

console-log-tree

1.2.1 • Public • Published

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)

Keywords

none

Install

npm i console-log-tree

DownloadsWeekly Downloads

47

Version

1.2.1

License

ISC

Unpacked Size

13.5 kB

Total Files

8

Last publish

Collaborators

  • avatar