Skip to content

Make colorful trees out of JSON objects using archy

License

Notifications You must be signed in to change notification settings

Surreal9/pretty-tree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Make colorful trees out of JSON objects using archy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%