12
12
13
13
## Contents
14
14
15
- * [ What is this?] ( #what-is-this )
16
- * [ When should I use this?] ( #when-should-i-use-this )
17
- * [ Install] ( #install )
18
- * [ Use] ( #use )
19
- * [ API] ( #api )
20
- * [ ` is(node[, test[, index, parent[, context]]]) ` ] ( #isnode-test-index-parent-context )
21
- * [ ` convert(test) ` ] ( #converttest )
22
- * [ ` Check ` ] ( #check )
23
- * [ ` Test ` ] ( #test )
24
- * [ ` TestFunction ` ] ( #testfunction )
25
- * [ Examples] ( #examples )
26
- * [ Example of ` convert ` ] ( #example-of-convert )
27
- * [ Types] ( #types )
28
- * [ Compatibility] ( #compatibility )
29
- * [ Related] ( #related )
30
- * [ Contribute] ( #contribute )
31
- * [ License] ( #license )
15
+ * [ What is this?] ( #what-is-this )
16
+ * [ When should I use this?] ( #when-should-i-use-this )
17
+ * [ Install] ( #install )
18
+ * [ Use] ( #use )
19
+ * [ API] ( #api )
20
+ * [ ` is(node[, test[, index, parent[, context]]]) ` ] ( #isnode-test-index-parent-context )
21
+ * [ ` convert(test) ` ] ( #converttest )
22
+ * [ ` Check ` ] ( #check )
23
+ * [ ` Test ` ] ( #test )
24
+ * [ ` TestFunction ` ] ( #testfunction )
25
+ * [ Examples] ( #examples )
26
+ * [ Example of ` convert ` ] ( #example-of-convert )
27
+ * [ Types] ( #types )
28
+ * [ Compatibility] ( #compatibility )
29
+ * [ Related] ( #related )
30
+ * [ Contribute] ( #contribute )
31
+ * [ License] ( #license )
32
32
33
33
## What is this?
34
34
@@ -107,16 +107,16 @@ Check if `node` is a `Node` and whether it passes the given test.
107
107
108
108
###### Parameters
109
109
110
- * ` node ` (` unknown ` , optional)
111
- — thing to check, typically [ ` Node ` ] [ node ]
112
- * ` test ` ([ ` Test ` ] [ api-test ] , optional)
113
- — a test for a specific element
114
- * ` index ` (` number ` , optional)
115
- — the node’s position in its parent
116
- * ` parent ` ([ ` Node ` ] [ node ] , optional)
117
- — the node’s parent
118
- * ` context ` (` unknown ` , optional)
119
- — context object (` this ` ) to call ` test ` with
110
+ * ` node ` (` unknown ` , optional)
111
+ — thing to check, typically [ ` Node ` ] [ node ]
112
+ * ` test ` ([ ` Test ` ] [ api-test ] , optional)
113
+ — a test for a specific element
114
+ * ` index ` (` number ` , optional)
115
+ — the node’s position in its parent
116
+ * ` parent ` ([ ` Node ` ] [ node ] , optional)
117
+ — the node’s parent
118
+ * ` context ` (` unknown ` , optional)
119
+ — context object (` this ` ) to call ` test ` with
120
120
121
121
###### Returns
122
122
@@ -139,8 +139,8 @@ a `node`, `index`, and `parent`.
139
139
140
140
###### Parameters
141
141
142
- * ` test ` ([ ` Test ` ] [ api-test ] , optional)
143
- — a test for a specific node
142
+ * ` test ` ([ ` Test ` ] [ api-test ] , optional)
143
+ — a test for a specific node
144
144
145
145
###### Returns
146
146
@@ -152,14 +152,14 @@ Check that an arbitrary value is a node (TypeScript type).
152
152
153
153
###### Parameters
154
154
155
- * ` this ` (` unknown ` , optional)
156
- — context object (` this ` ) to call ` test ` with
157
- * ` node ` (` unknown ` )
158
- — anything (typically a node)
159
- * ` index ` (` number ` , optional)
160
- — the node’s position in its parent
161
- * ` parent ` ([ ` Node ` ] [ node ] , optional)
162
- — the node’s parent
155
+ * ` this ` (` unknown ` , optional)
156
+ — context object (` this ` ) to call ` test ` with
157
+ * ` node ` (` unknown ` )
158
+ — anything (typically a node)
159
+ * ` index ` (` number ` , optional)
160
+ — the node’s position in its parent
161
+ * ` parent ` ([ ` Node ` ] [ node ] , optional)
162
+ — the node’s parent
163
163
164
164
###### Returns
165
165
@@ -183,24 +183,24 @@ type Test =
183
183
184
184
Checks that the given thing is a node, and then:
185
185
186
- * when ` string ` , checks that the node has that tag name
187
- * when ` function ` , see [ ` TestFunction ` ][api-test-function]
188
- * when ` object ` , checks that all keys in test are in node, and that they have
189
- (strictly) equal values
190
- * when ` Array ` , checks if one of the subtests pass
186
+ * when ` string ` , checks that the node has that tag name
187
+ * when ` function ` , see [ ` TestFunction ` ][api-test-function]
188
+ * when ` object ` , checks that all keys in test are in node, and that they have
189
+ (strictly) equal values
190
+ * when ` Array ` , checks if one of the subtests pass
191
191
192
192
### ` TestFunction `
193
193
194
194
Check if a node passes a test (TypeScript type).
195
195
196
196
###### Parameters
197
197
198
- * ` node ` ([ ` Node ` ][node])
199
- — a node
200
- * ` index ` ( ` number ` or ` undefined ` )
201
- — the node’s position in its parent
202
- * ` parent ` ([ ` Node ` ][node] or ` undefined ` )
203
- — the node’s parent
198
+ * ` node ` ([ ` Node ` ][node])
199
+ — a node
200
+ * ` index ` ( ` number ` or ` undefined ` )
201
+ — the node’s position in its parent
202
+ * ` parent ` ([ ` Node ` ][node] or ` undefined ` )
203
+ — the node’s parent
204
204
205
205
###### Returns
206
206
@@ -255,20 +255,20 @@ compatible with Node.js 16.
255
255
256
256
## Related
257
257
258
- * [ ` unist-util-find-after ` ] ( https://github.com/syntax-tree/unist-util-find-after )
259
- — find a node after another node
260
- * [ ` unist-util-find-before ` ] ( https://github.com/syntax-tree/unist-util-find-before )
261
- — find a node before another node
262
- * [ ` unist-util-find-all-after ` ] ( https://github.com/syntax-tree/unist-util-find-all-after )
263
- — find all nodes after another node
264
- * [ ` unist-util-find-all-before ` ] ( https://github.com/syntax-tree/unist-util-find-all-before )
265
- — find all nodes before another node
266
- * [ ` unist-util-find-all-between ` ] ( https://github.com/mrzmmr/unist-util-find-all-between )
267
- — find all nodes between two nodes
268
- * [ ` unist-util-filter ` ] ( https://github.com/syntax-tree/unist-util-filter )
269
- — create a new tree with nodes that pass a check
270
- * [ ` unist-util-remove ` ] ( https://github.com/syntax-tree/unist-util-remove )
271
- — remove nodes from tree
258
+ * [ ` unist-util-find-after ` ] ( https://github.com/syntax-tree/unist-util-find-after )
259
+ — find a node after another node
260
+ * [ ` unist-util-find-before ` ] ( https://github.com/syntax-tree/unist-util-find-before )
261
+ — find a node before another node
262
+ * [ ` unist-util-find-all-after ` ] ( https://github.com/syntax-tree/unist-util-find-all-after )
263
+ — find all nodes after another node
264
+ * [ ` unist-util-find-all-before ` ] ( https://github.com/syntax-tree/unist-util-find-all-before )
265
+ — find all nodes before another node
266
+ * [ ` unist-util-find-all-between ` ] ( https://github.com/mrzmmr/unist-util-find-all-between )
267
+ — find all nodes between two nodes
268
+ * [ ` unist-util-filter ` ] ( https://github.com/syntax-tree/unist-util-filter )
269
+ — create a new tree with nodes that pass a check
270
+ * [ ` unist-util-remove ` ] ( https://github.com/syntax-tree/unist-util-remove )
271
+ — remove nodes from tree
272
272
273
273
## Contribute
274
274
0 commit comments