1717* [ Install] ( #install )
1818* [ Use] ( #use )
1919* [ API] ( #api )
20- * [ ` inspect(node[, options]) ` ] ( #inspectnode-options )
21- * [ ` inspectColor(node[, options]) ` ] ( #inspectcolornode-options )
22- * [ ` inspectNoColor(node[, options]) ` ] ( #inspectnocolornode-options )
20+ * [ ` inspect(tree[, options]) ` ] ( #inspecttree-options )
21+ * [ ` inspectColor(tree[, options]) ` ] ( #inspectcolortree-options )
22+ * [ ` inspectNoColor(tree[, options]) ` ] ( #inspectnocolortree-options )
23+ * [ ` Options ` ] ( #options )
2324* [ Types] ( #types )
2425* [ Compatibility] ( #compatibility )
2526* [ Contribute] ( #contribute )
@@ -38,7 +39,7 @@ to more easily spot bugs and see what’s going on in the tree.
3839## Install
3940
4041This package is [ ESM only] [ esm ] .
41- In Node.js (version 12.20+, 14.14+, 16.0+, 18 .0+), install with [ npm] [ ] :
42+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
4243
4344``` sh
4445npm install unist-util-inspect
@@ -47,14 +48,14 @@ npm install unist-util-inspect
4748In Deno with [ ` esm.sh ` ] [ esmsh ] :
4849
4950``` js
50- import {inspect } from " https://esm.sh/unist-util-inspect@8 "
51+ import {inspect } from ' https://esm.sh/unist-util-inspect@7 '
5152```
5253
5354In browsers with [ ` esm.sh ` ] [ esmsh ] :
5455
5556``` html
5657<script type =" module" >
57- import {inspect } from " https://esm.sh/unist-util-inspect@7?bundle"
58+ import {inspect } from ' https://esm.sh/unist-util-inspect@7?bundle'
5859 </script >
5960```
6061
@@ -91,42 +92,54 @@ root[2]
9192
9293## API
9394
94- This package exports the identifiers ` inspect ` , ` inspectColor ` , and
95- ` inspectNoColor ` .
95+ This package exports the identifiers [ ` inspect ` ] [ api-inspect ] ,
96+ [ ` inspectColor ` ] [ api-inspectcolor ] , and [ ` inspectNoColor ` ] [ api-inspectnocolor ] .
9697There is no default export.
9798
98- ### ` inspect(node [, options]) `
99+ ### ` inspect(tree [, options]) `
99100
100- Inspect the given ` node ` ([ ` Node ` ] [ node ] ).
101- By default, colors are added in Node, and not in other places.
102- See below on how to change that.
101+ Inspect a tree, with color in Node, without color in browsers.
103102
104- ###### ` options.showPositions `
103+ ###### Parameters
105104
106- Whether to include positional information (` boolean ` , default: ` true ` ).
105+ * ` tree ` ([ ` Node ` ] [ node ] )
106+ — tree to inspect
107+ * ` options ` ([ ` Options ` ] [ api-options ] , optional)
108+ — configuration
107109
108- ##### Returns
110+ ###### Returns
109111
110- Pretty printed ` node ` (` string ` ).
112+ Pretty printed ` tree ` (` string ` ).
111113
112- ### ` inspectColor(node [, options]) `
114+ ### ` inspectColor(tree [, options]) `
113115
114- Inspect with ANSI color sequences (default in Node, Deno).
116+ Inspect a tree, with color.
117+ Otherwise same as [ ` inspect ` ] [ api-inspect ] .
115118
116- ### ` inspectNoColor(node [, options]) `
119+ ### ` inspectNoColor(tree [, options]) `
117120
118- Inspect without ANSI color sequences (default in browser, ` react-native ` ).
121+ Inspect a tree, without color.
122+ Otherwise same as [ ` inspect ` ] [ api-inspect ] .
123+
124+ ### ` Options `
125+
126+ Configuration (TypeScript type).
127+
128+ ###### Fields
129+
130+ * ` showPositions ` (` boolean ` , default: ` true ` )
131+ — whether to include positional information
119132
120133## Types
121134
122135This package is fully typed with [ TypeScript] [ ] .
123- It exports the additional type ` Options ` .
136+ It exports the additional type [ ` Options ` ] [ api-options ] .
124137
125138## Compatibility
126139
127140Projects maintained by the unified collective are compatible with all maintained
128141versions of Node.js.
129- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
142+ As of now, that is Node.js 14.14+ and 16 .0+.
130143Our projects sometimes work with older versions, but this is not guaranteed.
131144
132145## Contribute
@@ -194,3 +207,11 @@ abide by its terms.
194207[ unist ] : https://github.com/syntax-tree/unist
195208
196209[ node ] : https://github.com/syntax-tree/unist#node
210+
211+ [ api-inspect ] : #inspecttree-options
212+
213+ [ api-inspectcolor ] : #inspectcolortree-options
214+
215+ [ api-inspectnocolor ] : #inspectnocolortree-options
216+
217+ [ api-options ] : #options
0 commit comments