JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1261
  • Score
    100M100P100Q102414F

Make colorful trees out of JSON objects using archy

Package Exports

  • pretty-tree

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pretty-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pretty-tree

Make colorful trees out of JSON objects using archy

npm install pretty-tree

Usage

var tree = require('pretty-tree');

var str = tree({
    label: '(root)', // the label of this node
    nodes: [{
        label: '(child)',
        leaf: {
            hello: 'world',
            hej: 'verden'
        }
    }]
});

console.log(str);

The above example results in the following output:

example

The node passed to tree can contain the following options

tree({
    label: '(child)', // an optional lable of this node
    leaf: {           // set this if you want to print an object
        key: value,
        ...
    },
    nodes: [          // or put in some child nodes
        child_nodes_with_same_structure
    ]
})

If you want to disable coloring (even when the terminal is a tty) use tree.plain(options)

License

MIT