pretty-tree

Make colorful trees out of JSON objects using archy

5 个版本
安装
npm install pretty-tree
yarn add pretty-tree
pnpm add pretty-tree
bun add pretty-tree
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

版本列表
1.0.0 2015-02-24
0.2.0 2014-07-06
0.1.2 2014-01-06
0.1.1 2014-01-04
0.1.0 2014-01-04