
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
async-unist-util-visit
Advanced tools
Unist node visitor. Useful with working with remark or retext.
npm:
npm install unist-util-visit
unist-util-visit is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.
Dependencies:
var remark = require('remark');
var visit = require('unist-util-visit');
remark().use(function () {
return function (ast) {
visit(ast, 'text', function (node) {
console.log(node)
});
};
}).process('Some _emphasis_, **strongness**, and `code`.');
Yields:
{'type': 'text', 'value': 'Some '}
{'type': 'text', 'value': 'emphasis'}
{'type': 'text', 'value': ', '}
{'type': 'text', 'value': 'strongness'}
{'type': 'text', 'value': ', and '}
{'type': 'text', 'value': '.'}
visit(node[, type], visitor[, reverse])
Visit nodes. Optionally by node type. Optionally in reverse.
node
(Node
)
— Node to search;
type
(string
, optional)
— Node type;
visitor
(Function)
— Visitor invoked when a node is found;
reverse
(boolean
, default: false
)
— When falsey, checking starts at the first child and continues
through to later children. When truthy, this is reversed.
This does not mean checking starts at the deepest node and continues on to the highest node.
stop? = visitor(node, index, parent)
Invoked when a node (when type
is given, matching type
) is found.
Parameters:
node
(Node
) — Found node;index
(number?
) — Position of node
in parent
;index
(Node?
) — Parent of node
.Returns: boolean?
- When false
, visiting is immediately stopped.
FAQs
Recursively walk over unist nodes
The npm package async-unist-util-visit receives a total of 395 weekly downloads. As such, async-unist-util-visit popularity was classified as not popular.
We found that async-unist-util-visit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.