11# unist-util-visit
22
3- [ ![ Build] [ build-badge ]] [ build ]
4- [ ![ Coverage] [ coverage-badge ]] [ coverage ]
5- [ ![ Downloads] [ downloads-badge ]] [ downloads ]
6- [ ![ Size] [ size-badge ]] [ size ]
7- [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
8- [ ![ Backers] [ backers-badge ]] [ collective ]
9- [ ![ Chat] [ chat-badge ]] [ chat ]
3+ [ ![ Build] [ badge-build-image ]] [ badge-build-url ]
4+ [ ![ Coverage] [ badge-coverage-image ]] [ badge-coverage-url ]
5+ [ ![ Downloads] [ badge-downloads-image ]] [ badge-downloads-url ]
6+ [ ![ Size] [ badge-size-image ]] [ badge-size-url ]
107
11- [ unist] [ ] utility to walk the tree.
8+ [ unist] [ github-unist ] utility to walk the tree.
129
1310## Contents
1411
2825 * [ ` Test ` ] ( #test )
2926 * [ ` Visitor ` ] ( #visitor )
3027 * [ ` VisitorResult ` ] ( #visitorresult )
31- * [ Types] ( #types )
3228* [ Compatibility] ( #compatibility )
3329* [ Related] ( #related )
3430* [ Contribute] ( #contribute )
@@ -42,13 +38,14 @@ tree.
4238## When should I use this?
4339
4440You can use this utility when you want to walk the tree.
45- You can use [ ` unist-util-visit-parents ` ] [ vp ] if you care about the entire stack
46- of parents.
41+ You can use [ ` unist-util-visit-parents ` ] [ github- vp] if you care about the
42+ entire stack of parents.
4743
4844## Install
4945
50- This package is [ ESM only] [ esm ] .
51- In Node.js (version 16+), install with [ npm] [ ] :
46+ This package is [ ESM only] [ github-gist-esm ] .
47+ In Node.js (version 16+),
48+ install with [ npm] [ npmjs-install ] :
5249
5350``` sh
5451npm install unist-util-visit
@@ -94,13 +91,25 @@ Yields:
9491
9592## API
9693
97- This package exports the identifiers [ ` CONTINUE ` ] [ api-continue ] ,
98- [ ` EXIT ` ] [ api-exit ] , [ ` SKIP ` ] [ api-skip ] , and [ ` visit ` ] [ api-visit ] .
94+ This package exports the identifiers
95+ [ ` CONTINUE ` ] [ api-continue ] ,
96+ [ ` EXIT ` ] [ api-exit ] ,
97+ [ ` SKIP ` ] [ api-skip ] , and
98+ [ ` visit ` ] [ api-visit ] .
99+ It exports the [ TypeScript] [ ] types
100+ [ ` ActionTuple ` ] [ api-action-tuple ] ,
101+ [ ` Action ` ] [ api-action ] ,
102+ [ ` BuildVisitor ` ] [ api-build-visitor ] ,
103+ [ ` Index ` ] [ api-index ] ,
104+ [ ` Test ` ] [ api-test ] ,
105+ [ ` VisitorResult ` ] [ api-visitor-result ] , and
106+ [ ` Visitor ` ] [ api-visitor ] .
99107There is no default export.
100108
101109### ` visit(tree[, test], visitor[, reverse]) `
102110
103- This function works exactly the same as [ ` unist-util-visit-parents ` ] [ vp ] ,
111+ This function works exactly the same as
112+ [ ` unist-util-visit-parents ` ] [ github-vp ] ,
104113but [ ` Visitor ` ] [ api-visitor ] has a different signature.
105114
106115### ` CONTINUE `
@@ -118,26 +127,27 @@ Do not traverse this node’s children (`'skip'`).
118127### ` Action `
119128
120129Union of the action types (TypeScript type).
121- See [ ` Action ` in ` unist-util-visit-parents ` ] [ vp-action ] .
130+ See [ ` Action ` in ` unist-util-visit-parents ` ] [ github- vp-action] .
122131
123132### ` ActionTuple `
124133
125134List with an action and an index (TypeScript type).
126- See [ ` ActionTuple ` in ` unist-util-visit-parents ` ] [ vp-action-tuple ] .
135+ See [ ` ActionTuple ` in ` unist-util-visit-parents ` ] [ github- vp-action-tuple] .
127136
128137### ` BuildVisitor `
129138
130139Build a typed ` Visitor ` function from a tree and a test (TypeScript type).
131- See [ ` BuildVisitor ` in ` unist-util-visit-parents ` ] [ vp-build-visitor ] .
140+ See [ ` BuildVisitor ` in ` unist-util-visit-parents ` ] [ github- vp-build-visitor] .
132141
133142### ` Index `
134143
135144Move to the sibling at ` index ` next (TypeScript type).
136- See [ ` Index ` in ` unist-util-visit-parents ` ] [ vp-index ] .
145+ See [ ` Index ` in ` unist-util-visit-parents ` ] [ github- vp-index] .
137146
138147### ` Test `
139148
140- [ ` unist-util-is ` ] [ unist-util-is ] compatible test (TypeScript type).
149+ [ ` unist-util-is ` ] [ github-unist-util-is ] compatible test
150+ (TypeScript type).
141151
142152### ` Visitor `
143153
@@ -160,11 +170,11 @@ traversed.
160170
161171###### Parameters
162172
163- * ` node ` ([ ` Node ` ] [ node ] )
173+ * ` node ` ([ ` Node ` ] [ github-unist- node] )
164174 — found node
165175* ` index ` (` number ` or ` undefined ` )
166176 — index of ` node ` in ` parent `
167- * ` parent ` ([ ` Node ` ] [ node ] or ` undefined ` )
177+ * ` parent ` ([ ` Node ` ] [ github-unist- node] or ` undefined ` )
168178 — parent of ` node `
169179
170180###### Returns
@@ -181,15 +191,8 @@ When the `Action` is `CONTINUE`, `Index` can be returned.
181191### ` VisitorResult `
182192
183193Any value that can be returned from a visitor (TypeScript type).
184- See [ ` VisitorResult ` in ` unist-util-visit-parents ` ] [ vp-visitor-result ] .
185-
186- ## Types
187-
188- This package is fully typed with [ TypeScript] [ ] .
189- It exports the additional types [ ` Action ` ] [ api-action ] ,
190- [ ` ActionTuple ` ] [ api-action-tuple ] , [ ` BuildVisitor ` ] [ api-build-visitor ] ,
191- [ ` Index ` ] [ api-index ] , [ ` Test ` ] [ api-test ] , [ ` Visitor ` ] [ api-visitor ] , and
192- [ ` VisitorResult ` ] [ api-visitor-result ] .
194+ See [ ` VisitorResult ` in
195+ ` unist-util-visit-parents ` ] [ github-vp-visitor-result ] .
193196
194197## Compatibility
195198
@@ -203,7 +206,7 @@ compatible with Node.js 16.
203206
204207## Related
205208
206- * [ ` unist-util-visit-parents ` ] [ vp ]
209+ * [ ` unist-util-visit-parents ` ] [ github- vp]
207210 — walk the tree with a stack of parents
208211* [ ` unist-util-filter ` ] ( https://github.com/syntax-tree/unist-util-filter )
209212 — create a new tree with all nodes that pass a test
@@ -218,102 +221,93 @@ compatible with Node.js 16.
218221
219222## Contribute
220223
221- See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
222- ways to get started.
223- See [ ` support.md ` ] [ support ] for ways to get help.
224+ See [ ` contributing.md ` ] [ health- contributing] in [ ` syntax-tree/.github ` ] [ health ]
225+ for ways to get started.
226+ See [ ` support.md ` ] [ health- support] for ways to get help.
224227
225- This project has a [ code of conduct] [ coc ] .
226- By interacting with this repository, organization, or community you agree to
227- abide by its terms.
228+ This project has a [ code of conduct] [ health-coc ] .
229+ By interacting with this repository,
230+ organization,
231+ or community you agree to abide by its terms.
228232
229233## License
230234
231- [ MIT] [ license ] © [ Titus Wormer] [ author ]
235+ [ MIT] [ file- license] © [ Titus Wormer] [ wooorm ]
232236
233237<!-- Definition -->
234238
235- [ build-badge ] : https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg
236-
237- [ build ] : https://github.com/syntax-tree/unist-util-visit/actions
238-
239- [ coverage-badge ] : https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg
240-
241- [ coverage ] : https://codecov.io/github/syntax-tree/unist-util-visit
242-
243- [ downloads-badge ] : https://img.shields.io/npm/dm/unist-util-visit.svg
244-
245- [ downloads ] : https://www.npmjs.com/package/unist-util-visit
239+ [ api-action ] : #action
246240
247- [ size-badge ] : https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-visit
241+ [ api-action-tuple ] : #actiontuple
248242
249- [ size ] : https://bundlejs.com/?q=unist-util-visit
243+ [ api-build-visitor ] : #buildvisitor
250244
251- [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
245+ [ api-continue ] : #continue
252246
253- [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
247+ [ api-exit ] : #exit
254248
255- [ collective ] : https://opencollective.com/unified
249+ [ api-index ] : #index
256250
257- [ chat-badge ] : https://img.shields.io/badge/chat-discussions-success.svg
251+ [ api-skip ] : #skip
258252
259- [ chat ] : https://github.com/syntax-tree/unist/discussions
253+ [ api-test ] : #test
260254
261- [ npm ] : https://docs.npmjs.com/cli/install
255+ [ api-visit ] : #visittree-test-visitor-reverse
262256
263- [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
257+ [ api-visitor ] : #visitor
264258
265- [ esmsh ] : https://esm.sh
259+ [ api-visitor-result ] : #visitorresult
266260
267- [ typescript ] : https://www.typescriptlang.org
261+ [ badge-build-image ] : https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg
268262
269- [ license ] : license
263+ [ badge-build-url ] : https://github.com/syntax-tree/unist-util-visit/actions
270264
271- [ author ] : https://wooorm.com
265+ [ badge-coverage-image ] : https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg
272266
273- [ health ] : https://github.com/ syntax-tree/.github
267+ [ badge-coverage-url ] : https://codecov.io/github/ syntax-tree/unist-util-visit
274268
275- [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
269+ [ badge-downloads-image ] : https://img.shields.io/npm/dm/unist-util-visit.svg
276270
277- [ support ] : https://github. com/syntax-tree/.github/blob/main/support.md
271+ [ badge-downloads-url ] : https://www.npmjs. com/package/unist-util-visit
278272
279- [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
273+ [ badge-size-image ] : https://img.shields.io/bundlejs/size/unist-util-visit
280274
281- [ unist ] : https://github .com/syntax-tree/ unist
275+ [ badge-size-url ] : https://bundlejs .com/?q= unist-util-visit
282276
283- [ node ] : https://github.com/syntax-tree/unist#nodes
277+ [ esmsh ] : https://esm.sh
284278
285- [ unist-util-is ] : https://github.com/syntax-tree/unist-util-is
279+ [ file-license ] : license
286280
287- [ vp ] : https://github.com/syntax-tree/unist-util-visit-parents
281+ [ github-gist-esm ] : https://gist. github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
288282
289- [ vp-action ] : https://github.com/syntax-tree/unist-util-visit-parents#action
283+ [ github-unist ] : https://github.com/syntax-tree/unist
290284
291- [ vp-action-tuple ] : https://github.com/syntax-tree/unist-util-visit-parents#actiontuple
285+ [ github-unist-node ] : https://github.com/syntax-tree/unist#nodes
292286
293- [ vp-build-visitor ] : https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor
287+ [ github-unist-util-is ] : https://github.com/syntax-tree/unist-util-is
294288
295- [ vp-index ] : https://github.com/syntax-tree/unist-util-visit-parents#index
289+ [ github-vp ] : https://github.com/syntax-tree/unist-util-visit-parents
296290
297- [ vp-visitor-result ] : https://github.com/syntax-tree/unist-util-visit-parents#visitorresult
291+ [ github- vp-action ] : https://github.com/syntax-tree/unist-util-visit-parents#action
298292
299- [ api-visit ] : #visittree-test-visitor-reverse
293+ [ github-vp-action-tuple ] : https://github.com/syntax-tree/unist-util-visit-parents#actiontuple
300294
301- [ api-continue ] : #continue
295+ [ github-vp-build-visitor ] : https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor
302296
303- [ api-exit ] : #exit
297+ [ github-vp-index ] : https://github.com/syntax-tree/unist-util-visit-parents#index
304298
305- [ api-skip ] : #skip
299+ [ github-vp-visitor-result ] : https://github.com/syntax-tree/unist-util-visit-parents#visitorresult
306300
307- [ api-action ] : #action
301+ [ health ] : https://github.com/syntax-tree/.github
308302
309- [ api-action-tuple ] : #actiontuple
303+ [ health-coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
310304
311- [ api-build-visitor ] : #buildvisitor
305+ [ health-contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
312306
313- [ api-index ] : #index
307+ [ health-support ] : https://github.com/syntax-tree/.github/blob/main/support.md
314308
315- [ api-test ] : #test
309+ [ npmjs-install ] : https://docs.npmjs.com/cli/install
316310
317- [ api-visitor ] : #visitor
311+ [ typescript ] : https://www.typescriptlang.org
318312
319- [ api-visitor-result ] : #visitorresult
313+ [ wooorm ] : https://wooorm.com
0 commit comments