{"id":20348977,"url":"https://github.com/here-be/snapdragon-visit","last_synced_at":"2026-05-11T02:52:27.604Z","repository":{"id":57364576,"uuid":"111502617","full_name":"here-be/snapdragon-visit","owner":"here-be","description":"visit and mapVisit methods for snapdragon nodes.","archived":false,"fork":false,"pushed_at":"2017-11-21T05:16:50.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-20T08:18:35.262Z","etag":null,"topics":["ast","compiler","javascript","node","nodejs","parser","snapdragon"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/here-be.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-21T05:14:34.000Z","updated_at":"2017-11-30T13:38:12.000Z","dependencies_parsed_at":"2022-09-13T21:01:09.797Z","dependency_job_id":null,"html_url":"https://github.com/here-be/snapdragon-visit","commit_stats":null,"previous_names":["jonschlinkert/snapdragon-visit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/here-be%2Fsnapdragon-visit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/here-be%2Fsnapdragon-visit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/here-be%2Fsnapdragon-visit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/here-be%2Fsnapdragon-visit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/here-be","download_url":"https://codeload.github.com/here-be/snapdragon-visit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241877700,"owners_count":20035479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","compiler","javascript","node","nodejs","parser","snapdragon"],"created_at":"2024-11-14T22:23:30.840Z","updated_at":"2026-05-11T02:52:22.563Z","avatar_url":"https://github.com/here-be.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snapdragon-visit [![NPM version](https://img.shields.io/npm/v/snapdragon-visit.svg?style=flat)](https://www.npmjs.com/package/snapdragon-visit) [![NPM monthly downloads](https://img.shields.io/npm/dm/snapdragon-visit.svg?style=flat)](https://npmjs.org/package/snapdragon-visit) [![NPM total downloads](https://img.shields.io/npm/dt/snapdragon-visit.svg?style=flat)](https://npmjs.org/package/snapdragon-visit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon-visit.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/snapdragon-visit)\n\n\u003e visit and mapVisit methods for snapdragon nodes.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save snapdragon-visit\n```\n\n## Usage\n\nUse `snapdragon-visit` in your node.js library with the following line of code:\n\n```js\nconst visit = require('snapdragon-visit');\n```\n\n## API\n\n### [visit](index.js#L24)\n\nVisit the given `node` with the specified function, the calls [mapVisit](#mapVisit) if `node.nodes` exists.\n\n**Params**\n\n* `node` **{Object}**: (required) Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node), or if a plain object is passed it will be converted to an instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node).\n* `fn` **{Function}**: (required)\n* `parent` **{Object}**: (optional) Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) to use as the `node.parent`\n* `returns` **{Object}**: Returns the given node.\n\n**Example**\n\n```js\nconst ast = new Node({type: 'root'});\nvisit(ast, function(node) {\n  node.val = '*';\n});\nconsole.log(ast.val);\n//=\u003e '*'\n```\n\n### [mapVisit](index.js#L58)\n\nCalls [visit](#visit) on each node in `node.nodes`.\n\n**Params**\n\n* `node` **{Object}**\n* `fn` **{Function}**\n* `returns` **{Object}**: Returns the given node.\n\n**Example**\n\n```js\nvar node = new Node({type: 'star', val: ''});\nvar ast = new Node({type: 'root', nodes: []});\nast.push(node);\n\nvisit.map(ast, function(node) {\n  if (node.type === 'star') {\n    node.val = '*';\n  }\n});\n\nconsole.log(node.val);\n//=\u003e '*'\n```\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [snapdragon-node](https://www.npmjs.com/package/snapdragon-node): Snapdragon utility for creating a new AST node in custom code, such as plugins. | [homepage](https://github.com/jonschlinkert/snapdragon-node \"Snapdragon utility for creating a new AST node in custom code, such as plugins.\")\n* [snapdragon-token](https://www.npmjs.com/package/snapdragon-token): Create a snapdragon token. Used by the snapdragon lexer, but can also be used by… [more](https://github.com/jonschlinkert/snapdragon-token) | [homepage](https://github.com/jonschlinkert/snapdragon-token \"Create a snapdragon token. Used by the snapdragon lexer, but can also be used by plugins.\")\n* [snapdragon](https://www.npmjs.com/package/snapdragon): Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map… [more](https://github.com/jonschlinkert/snapdragon) | [homepage](https://github.com/jonschlinkert/snapdragon \"Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map support.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 21, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhere-be%2Fsnapdragon-visit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhere-be%2Fsnapdragon-visit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhere-be%2Fsnapdragon-visit/lists"}