{"_id":"unist-util-visit@5.2.0","bugs":{"url":"https://github.com/syntax-tree/unist-util-visit/issues"},"dist":{"shasum":"914256bc5e1801e280c12970fad4328352645974","tarball":"http://registry-npm.ywwl.com/unist-util-visit/download/unist-util-visit-5.2.0.tgz","fileCount":8,"integrity":"sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==","signatures":[{"sig":"MEQCICpiOUewaz+2G1MrApFMQgqNMkC8qyxdCodlE4EbflUtAiAWLzxRKD57zCEPk4yx5+YLpz4tgFNMWyuTJp4Qz3QpXw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAcxsXcUxEeMer5MlEBtR+6X9eIRUzik0+e75300PZ3BAiBwHr3rQcJXcajl6D3lGnbsXSj1g6TOCeYwIYvpByOp/g=="}],"unpackedSize":35985,"size":8429,"noattachment":false,"key":"/unist-util-visit/-/unist-util-visit-5.2.0.tgz"},"name":"unist-util-visit","type":"module","types":"./index.d.ts","author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"2792aa8277199768662990a471ef409e337cad1f","license":"MIT","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && tsd && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","prepack":"npm run build && npm run format","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov npm run test-api"},"version":"5.2.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"homepage":"https://github.com/syntax-tree/unist-util-visit#readme","keywords":["ast","hast","html","language","markdown","mdast","natural","nlcst","node","rehype","remark","retext","tree","unist-util","unist","utility","util","visit","walk","xast","xml"],"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/unist-util-visit.git","type":"git"},"_npmVersion":"12.2.1","description":"unist utility to visit nodes","directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"sideEffects":false,"_nodeVersion":"26.12.1","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},{"name":"Eugene Sharygin","email":"eush77@gmail.com"},{"name":"Richard Gibson","email":"richard.gibson@gmail.com"}],"dependencies":{"@types/unist":"^3.0.0","unist-util-is":"^6.0.0","unist-util-visit-parents":"^6.1.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"#":"needed `any`s","strict":true,"atLeast":100,"ignoreFiles":["lib/index.d.ts"]},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","tsd":"^0.33.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","@types/mdast":"^4.0.0","type-coverage":"^2.0.0","mdast-util-gfm":"^3.0.0","remark-preset-wooorm":"^11.0.0","micromark-extension-gfm":"^3.0.0","mdast-util-from-markdown":"^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unist-util-visit_5.2.0_1792867476712_0.2393774313480863"},"readme":"# unist-util-visit\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n\n[unist][github-unist] utility to walk the tree.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`visit(tree[, test], enter|visitors[, reverse])`](#visittree-test-entervisitors-reverse)\n  * [`CONTINUE`](#continue)\n  * [`EXIT`](#exit)\n  * [`SKIP`](#skip)\n  * [`Action`](#action)\n  * [`ActionTuple`](#actiontuple)\n  * [`BuildVisitor`](#buildvisitor)\n  * [`BuildVisitors`](#buildvisitors)\n  * [`Index`](#index)\n  * [`Test`](#test)\n  * [`Visitor`](#visitor)\n  * [`VisitorExit`](#visitorexit)\n  * [`VisitorResult`](#visitorresult)\n  * [`VisitorResultExit`](#visitorresultexit)\n  * [`Visitors`](#visitors)\n* [Compatibility](#compatibility)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis is a very important utility for working with unist as it lets you walk the\ntree.\n\n## When should I use this?\n\nYou can use this utility when you want to walk the tree.\nYou can use [`unist-util-visit-parents`][github-vp] if you care about the\nentire stack of parents.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+),\ninstall with [npm][npmjs-install]:\n\n```sh\nnpm install unist-util-visit\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {CONTINUE, EXIT, SKIP, visit} from 'https://esm.sh/unist-util-visit@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {CONTINUE, EXIT, SKIP, visit} from 'https://esm.sh/unist-util-visit@5?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {visit} from 'unist-util-visit'\n\nconst tree = fromMarkdown('Some *emphasis*, **strong**, and `code`.')\n\nvisit(tree, 'text', function (node, index, parent) {\n  console.log([node.value, parent ? parent.type : index])\n})\n```\n\nYields:\n\n```js\n[ 'Some ', 'paragraph' ]\n[ 'emphasis', 'emphasis' ]\n[ ', ', 'paragraph' ]\n[ 'strong', 'strong' ]\n[ ', and ', 'paragraph' ]\n[ '.', 'paragraph' ]\n```\n\n## API\n\nThis package exports the identifiers\n[`CONTINUE`][api-continue],\n[`EXIT`][api-exit],\n[`SKIP`][api-skip], and\n[`visit`][api-visit].\nIt exports the [TypeScript][] types\n[`ActionTuple`][api-action-tuple],\n[`Action`][api-action],\n[`BuildVisitor`][api-build-visitor],\n[`BuildVisitors`][api-build-visitors],\n[`Index`][api-index],\n[`Test`][api-test],\n[`VisitorExit`][api-visitor-exit],\n[`VisitorResultExit`][api-visitor-result-exit],\n[`VisitorResult`][api-visitor-result],\n[`Visitors`][api-visitors], and\n[`Visitor`][api-visitor].\nThere is no default export.\n\n### `visit(tree[, test], enter|visitors[, reverse])`\n\nThis function works exactly the same as\n[`unist-util-visit-parents`][github-vp],\nbut [`Visitor`][api-visitor] and [`VisitorExit`][api-visitor-exit] have a\ndifferent signature.\n\n###### Signatures\n\n* `visit(tree[, test], enter[, reverse])`\n* `visit(tree[, test], visitors[, reverse])`\n\n### `CONTINUE`\n\nContinue traversing as normal (`true`).\n\n### `EXIT`\n\nStop traversing immediately (`false`).\n\n### `SKIP`\n\nDo not traverse this node’s children (`'skip'`).\n\n### `Action`\n\nUnion of the action types (TypeScript type).\nSee [`Action` in `unist-util-visit-parents`][github-vp-action].\n\n### `ActionTuple`\n\nList with an action and an index (TypeScript type).\nSee [`ActionTuple` in `unist-util-visit-parents`][github-vp-action-tuple].\n\n### `BuildVisitor`\n\nBuild a typed `Visitor` function from a tree and a test (TypeScript type).\nSee [`BuildVisitor` in `unist-util-visit-parents`][github-vp-build-visitor].\n\n### `BuildVisitors`\n\nBuild typed [`Visitors`][api-visitors] from a tree and a test (TypeScript\ntype).\nSee [`BuildVisitors` in `unist-util-visit-parents`][github-vp-build-visitors].\n\n### `Index`\n\nMove to the sibling at `index` next (TypeScript type).\nSee [`Index` in `unist-util-visit-parents`][github-vp-index].\n\n### `Test`\n\n[`unist-util-is`][github-unist-util-is] compatible test\n(TypeScript type).\n\n### `Visitor`\n\nHandle a node (matching `test`, if given) before its children (TypeScript\ntype).\nLike [`Visitor` in `unist-util-visit-parents`][github-vp-visitor],\nbut with `index` and `parent` instead of `parents`.\n\n###### Parameters\n\n* `node` ([`Node`][github-unist-node])\n  — found node\n* `index` (`number` or `undefined`)\n  — index of `node` in `parent`,\n  or `undefined` for the tree itself\n* `parent` ([`Node`][github-unist-node] or `undefined`)\n  — parent of `node`,\n  or `undefined` for the tree itself\n\n###### Returns\n\nWhat to do next ([`VisitorResult`][api-visitor-result]).\n\n### `VisitorExit`\n\nHandle a node (matching `test`, if given) after its children (TypeScript type).\nLike [`VisitorExit` in `unist-util-visit-parents`][github-vp-visitor-exit],\nbut with `index` and `parent` instead of `parents`.\n\n###### Parameters\n\n* `node` ([`Node`][github-unist-node])\n  — found node\n* `index` (`number` or `undefined`)\n  — index of `node` in `parent`,\n  or `undefined` for the tree itself\n* `parent` ([`Node`][github-unist-node] or `undefined`)\n  — parent of `node`,\n  or `undefined` for the tree itself\n\n###### Returns\n\nWhat to do next ([`VisitorResultExit`][api-visitor-result-exit]).\n\n### `VisitorResult`\n\nAny value that can be returned from a visitor (TypeScript type).\nSee [`VisitorResult` in\n`unist-util-visit-parents`][github-vp-visitor-result].\n\n### `VisitorResultExit`\n\nAny value that can be returned from an exit visitor (TypeScript type).\nSee [`VisitorResultExit` in\n`unist-util-visit-parents`][github-vp-visitor-result-exit].\n\n### `Visitors`\n\nHandle nodes when entering and exiting them (TypeScript type).\nSee [`Visitors` in `unist-util-visit-parents`][github-vp-visitors].\n\n###### Fields\n\n* `enter` ([`Visitor`][api-visitor], optional)\n  — handle a node before its children\n* `exit` ([`VisitorExit`][api-visitor-exit])\n  — handle a node after its children\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `unist-util-visit@^5`,\ncompatible with Node.js 16.\n\n## Related\n\n* [`unist-util-visit-parents`][github-vp]\n  — walk the tree with a stack of parents\n* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)\n  — create a new tree with all nodes that pass a test\n* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map)\n  — create a new tree with all nodes mapped by a given function\n* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap)\n  — create a new tree by mapping (to an array) with the given function\n* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)\n  — remove nodes from a tree that pass a test\n* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select)\n  — select nodes with CSS-like selectors\n\n## Contribute\n\nSee [`contributing.md`][health-contributing] in [`syntax-tree/.github`][health]\nfor ways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository,\norganization,\nor community you agree to abide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definition -->\n\n[api-action]: #action\n\n[api-action-tuple]: #actiontuple\n\n[api-build-visitor]: #buildvisitor\n\n[api-build-visitors]: #buildvisitors\n\n[api-continue]: #continue\n\n[api-exit]: #exit\n\n[api-index]: #index\n\n[api-skip]: #skip\n\n[api-test]: #test\n\n[api-visit]: #visittree-test-entervisitors-reverse\n\n[api-visitor]: #visitor\n\n[api-visitor-exit]: #visitorexit\n\n[api-visitor-result]: #visitorresult\n\n[api-visitor-result-exit]: #visitorresultexit\n\n[api-visitors]: #visitors\n\n[badge-build-image]: https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/syntax-tree/unist-util-visit/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg\n\n[badge-coverage-url]: https://codecov.io/github/syntax-tree/unist-util-visit\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/unist-util-visit.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/unist-util-visit\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/unist-util-visit\n\n[badge-size-url]: https://bundlejs.com/?q=unist-util-visit\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-unist]: https://github.com/syntax-tree/unist\n\n[github-unist-node]: https://github.com/syntax-tree/unist#nodes\n\n[github-unist-util-is]: https://github.com/syntax-tree/unist-util-is\n\n[github-vp]: https://github.com/syntax-tree/unist-util-visit-parents\n\n[github-vp-action]: https://github.com/syntax-tree/unist-util-visit-parents#action\n\n[github-vp-action-tuple]: https://github.com/syntax-tree/unist-util-visit-parents#actiontuple\n\n[github-vp-build-visitor]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor\n\n[github-vp-build-visitors]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitors\n\n[github-vp-index]: https://github.com/syntax-tree/unist-util-visit-parents#index\n\n[github-vp-visitor]: https://github.com/syntax-tree/unist-util-visit-parents#visitor\n\n[github-vp-visitor-exit]: https://github.com/syntax-tree/unist-util-visit-parents#visitorexit\n\n[github-vp-visitor-result]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresult\n\n[github-vp-visitor-result-exit]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresultexit\n\n[github-vp-visitors]: https://github.com/syntax-tree/unist-util-visit-parents#visitors\n\n[health]: https://github.com/syntax-tree/.github\n\n[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","publish_time":1792867476789,"_cnpm_publish_time":1792867476789,"dist-tags":{"latest":"5.2.0"}}