unist-util-inspect
unist utility to inspect nodes
Last updated 5 months ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install unist-util-inspect 
SYNC missed versions from official npm registry.

unist-util-inspect

Build Coverage Downloads Size Sponsors Backers Chat

unist utility to inspect nodes.

Install

npm:

npm install unist-util-inspect

Use

var u = require('unist-builder')
var inspect = require('unist-util-inspect')

var tree = u('root', [
  u('literal', '1'),
  u('parent', [
    u('void', {id: 'a'}),
    u('literal', '2'),
    u('node', {id: 'b'}, [])
  ])
])

console.log(inspect(tree))

Yields:

root[2]
├─0 literal "1"
└─1 parent[3]
    ├─0 void
    │     id: "a"
    ├─1 literal "2"
    └─2 node[0]
          id: "b"

API

inspect(node[, options])

Inspect the given node. By default, colors are added in Node, and not in other places. See below on how to change that.

options.showPositions

Whether to include positional information (boolean, default: true).

Returns

string — String representing node.

inspect.<style>[.<style>…](node[, options])

Where <style> is either color or noColor.

To explicitly add or remove ANSI sequences, use inspect.color(node) or inspect.noColor(node).

Contribute

See contributing.md in syntax-tree/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Current Tags

  • 6.0.0                                ...           latest (5 months ago)

13 Versions

  • 6.0.0                                ...           5 months ago
  • 5.0.1                                ...           7 months ago
  • 5.0.0                                ...           a year ago
  • 4.1.4                                ...           a year ago
  • 4.1.3                                ...           2 years ago
  • 4.1.2                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (2)
Downloads
Today 111
This Week 358
This Month 2,382
Last Day 134
Last Week 656
Last Month 3,136
Dependencies (0)
None
Dev Dependencies (17)

Copyright 2014 - 2016 © taobao.org |