17
17
* [ Install] ( #install )
18
18
* [ Use] ( #use )
19
19
* [ 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 )
23
24
* [ Types] ( #types )
24
25
* [ Compatibility] ( #compatibility )
25
26
* [ Contribute] ( #contribute )
@@ -38,7 +39,7 @@ to more easily spot bugs and see what’s going on in the tree.
38
39
## Install
39
40
40
41
This 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] [ ] :
42
43
43
44
``` sh
44
45
npm install unist-util-inspect
@@ -47,14 +48,14 @@ npm install unist-util-inspect
47
48
In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
49
49
50
``` js
50
- import {inspect } from " https://esm.sh/unist-util-inspect@8 "
51
+ import {inspect } from ' https://esm.sh/unist-util-inspect@7 '
51
52
```
52
53
53
54
In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
55
55
56
``` html
56
57
<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'
58
59
</script >
59
60
```
60
61
@@ -91,42 +92,54 @@ root[2]
91
92
92
93
## API
93
94
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 ] .
96
97
There is no default export.
97
98
98
- ### ` inspect(node [, options]) `
99
+ ### ` inspect(tree [, options]) `
99
100
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.
103
102
104
- ###### ` options.showPositions `
103
+ ###### Parameters
105
104
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
107
109
108
- ##### Returns
110
+ ###### Returns
109
111
110
- Pretty printed ` node ` (` string ` ).
112
+ Pretty printed ` tree ` (` string ` ).
111
113
112
- ### ` inspectColor(node [, options]) `
114
+ ### ` inspectColor(tree [, options]) `
113
115
114
- Inspect with ANSI color sequences (default in Node, Deno).
116
+ Inspect a tree, with color.
117
+ Otherwise same as [ ` inspect ` ] [ api-inspect ] .
115
118
116
- ### ` inspectNoColor(node [, options]) `
119
+ ### ` inspectNoColor(tree [, options]) `
117
120
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
119
132
120
133
## Types
121
134
122
135
This package is fully typed with [ TypeScript] [ ] .
123
- It exports the additional type ` Options ` .
136
+ It exports the additional type [ ` Options ` ] [ api-options ] .
124
137
125
138
## Compatibility
126
139
127
140
Projects maintained by the unified collective are compatible with all maintained
128
141
versions 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+.
130
143
Our projects sometimes work with older versions, but this is not guaranteed.
131
144
132
145
## Contribute
@@ -194,3 +207,11 @@ abide by its terms.
194
207
[ unist ] : https://github.com/syntax-tree/unist
195
208
196
209
[ 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