{"name":"unist-util-visit-children","version":"2.0.2","description":"unist utility to visit direct children of a parent","license":"MIT","keywords":["unist","unist-util","util","utility","visit","children"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/unist-util-visit-children.git"},"bugs":{"url":"https://github.com/syntax-tree/unist-util-visit-children/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/unist":"^2.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","tsd":"^0.25.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && tsd && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"d957b0494d0656157238dd3a2901bf9b67c778fd","homepage":"https://github.com/syntax-tree/unist-util-visit-children#readme","_id":"unist-util-visit-children@2.0.2","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-+LWpMFqyUwLGpsQxpumsQ9o9DG2VGLFrpz+rpVXYIEdPy57GSy5HioC0g3bg/8WP9oCLlapQtklOzQ8uLS496Q==","shasum":"0f00a5caff567074568da2d89c54b5ee4a8c5440","tarball":"http://registry-npm.ywwl.com/unist-util-visit-children/download/unist-util-visit-children-2.0.2.tgz","fileCount":7,"unpackedSize":13738,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+zV5sSZ2Qgv0Cfj7LDp2lbzILmd1i3hO6/I1WE338ogIgUdScCamWzS147rk6/S3QQWtUaJ/BoJkmPr8EbTzmi4E="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjzq4tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsGg//ThhCUXN8EJ1VIH/EcqL9WvPAAlUb/prnKPQY/j0blgzju4+7\r\n7KIsA0zCeE2cafvAvFG0l1YuCsiV8mwQW/Pl2vcTnAGOCCVwgAAtjGrFGgIh\r\n+lR9yUxXPXEpnVmWkM4OnlVj/7XYPtHApj+ZfQ3Lv4sU/dyrpJQF2YW9SHBU\r\nVlJrew3lZoHmbRTViQSgaXTHm3sSY97syoZ/HLQo9mi7+fwI3Hb67foYW61r\r\nwHe77b/2ZAaH/HXtkeZ0Zt0ZlYwOOam0cTZMp+pGJDntulfbGhYMn3XnmNF8\r\nFrp6i2rxZaP6q85IaWd/8lWXfxYgZuFrm0HJNK6zX/FZtcXZMVUJ8chDaDdO\r\nd+kRSd0BCl/mV9c/hGH/oDbruNJ1DQwMEucna1xDmuaW3Vxr8u+Beq7CBr8N\r\ncSYdhP8+5mLg9Eneq+jHkS3yHQKTNSy7W11721HSd93ydoUrrJfyCTZ/LheY\r\nq0w4HeJ3QKEz1q+cXqA+ONI0Th29BmCvi748HvHjGUjj1yvk3yRBONdR3P2I\r\nE32KL4siEYDvGfK/pKbsz3NAL9F/KFJhWpn7JyD1N6lB8aLQ0isc5+gzwM9T\r\nLK3kfy086YhDqXfHy3svAjjvD2/YwfryOby5kBRkISOJ6Hv4xgJVNmkGi621\r\nDdm9I6XTn7hk0HbEqas3aoorf7ukuS1ZSO8=\r\n=vEd6\r\n-----END PGP SIGNATURE-----\r\n","size":4191,"noattachment":false,"key":"/unist-util-visit-children/-/unist-util-visit-children-2.0.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-util-visit-children_2.0.2_1674489388966_0.7977830238945716"},"_hasShrinkwrap":false,"readme":"# unist-util-visit-children\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[unist][] utility to visit direct children of a parent.\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    *   [`visitChildren(visitor)`](#visitchildrenvisitor)\n    *   [`Visitor`](#visitor)\n    *   [`Visit`](#visit)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis is a tiny utility that you can use to create a reusable function that\nonly visits direct children.\n\n## When should I use this?\n\nProbably never!\nUse [`unist-util-visit`][unist-util-visit].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install unist-util-visit-children\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {visitChildren} from 'https://esm.sh/unist-util-visit-children@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {visitChildren} from 'https://esm.sh/unist-util-visit-children@3?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport u from 'unist-builder'\nimport {visitChildren} from 'unist-util-visit-children'\n\nconst visit = visitChildren(function (node) {\n  console.log(node)\n})\n\nconst tree = u('tree', [\n  u('leaf', 'leaf 1'),\n  u('node', [u('leaf', 'leaf 2'), u('leaf', 'leaf 3')]),\n  u('leaf', 'leaf 4'),\n  u('void')\n])\n\nvisit(tree)\n```\n\nYields:\n\n```js\n{type: 'leaf', value: 'leaf 1'}\n{\n  type: 'node',\n  children: [\n    {type: 'leaf', value: 'leaf 2'},\n    {type: 'leaf', value: 'leaf 3'}\n  ]\n}\n{type: 'leaf', value: 'leaf 4'}\n{type: 'void'}\n```\n\n## API\n\nThis package exports the identifier [`visitChildren`][api-visitchildren].\nThere is no default export.\n\n### `visitChildren(visitor)`\n\nWrap `visitor` to be called for each child in the nodes later given to `visit`.\n\n###### Parameters\n\n*   `visitor` ([`Visitor`][api-visitor])\n    — callback called for each `child` in `parent` later given to `visit`\n\n###### Returns\n\nFunction to call the bound `visitor` for each child in `parent`\n([`Visit`][api-visit]).\n\n### `Visitor`\n\nCallback called for each `child` in `parent` later given to `visit`\n(TypeScript type).\n\n###### Parameters\n\n*   `child` ([`Node`][node])\n    — child of parent\n*   `index` (`number`)\n    — position of `child` in parent\n*   `parent` ([`Node`][node])\n    — parent node\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Visit`\n\nFunction to call the bound `visitor` for each child in `parent`\n(TypeScript type).\n\n###### Parameters\n\n*   `parent` ([`Node`][node])\n    — parent node\n\n###### Returns\n\nNothing (`undefined`).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`Visit`][api-visit] and\n[`Visitor`][api-visitor].\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,\n`unist-util-visit-children@^3`, compatible with Node.js 16.\n\n## Related\n\n*   [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit)\n    — walk the tree\n*   [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents)\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-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)\n    — find nodes after another node\n*   [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)\n    — find nodes before another node\n*   [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)\n    — find a node after another node\n*   [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)\n    — find a node before another node\n*   [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)\n    — find all nodes between two nodes\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`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organisation, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definition -->\n\n[build-badge]: https://github.com/syntax-tree/unist-util-visit-children/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/unist-util-visit-children/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-children.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-children\n\n[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-children.svg\n\n[downloads]: https://www.npmjs.com/package/unist-util-visit-children\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-visit-children\n\n[size]: https://bundlejs.com/?q=unist-util-visit-children\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[unist]: https://github.com/syntax-tree/unist\n\n[node]: https://github.com/syntax-tree/unist#nodes\n\n[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit\n\n[api-visitchildren]: #visitchildrenvisitor\n\n[api-visit]: #visit\n\n[api-visitor]: #visitor\n","publish_time":1674489389177,"_cnpm_publish_time":1674489389177,"dist-tags":{"latest":"3.0.0"}}