Package Exports
- unist-util-visit
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unist-util-visit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
unist-util-visit

Unist node visitor. Useful when working with mdast or retext.
Installation
npm:
npm install unist-util-visitunist-util-visit is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
Usage
var mdast = require('mdast');
var visit = require('unist-util-visit');
mdast().use(function (ast) {
visit(ast, 'text', console.log.bind(console));
}).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': '.'}API
visit(node[, type], callback[, reverse])
visitis synchronous.
Visit nodes. Optionally by node type. Optionally in reverse.
node(Node) — Unist node;type(string, optional) — Optional node type to invokecallbackfor. By default, all nodes are visited.callback(function(node, index?, parent?)) — Callback invoked when a node (matchingtype?) is found. Invoked with the node, itsindexinparent(ornull), and itsparent(ornull).Can return
falseto immediately stop checking.reverse(boolean, default:false, optional) — 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.