Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
mdast-util-visit
Advanced tools
mdast utility to recursively walk over nodes: both forwards and backwards.
npm:
npm install mdast-util-visit
mdast-util-visit is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
/*
* Dependencies.
*/
var mdast = require('mdast');
var visit = require('mdast-util-visit');
/*
* AST.
*/
var ast = mdast.parse('Some *emphasis*, **strongness**, and `code`.');
visit(ast, 'text', console.log.bind(console));
/*
* {type: 'text', 'value': 'Some '}
* {type: 'text', 'value': 'emphasis'}
* {type: 'text', 'value': ', '}
* {type: 'text', 'value': 'strongness'}
* {type: 'text', 'value': ', and '}
* {type: 'text', 'value': '.'}
*/
Visit nodes. Optionally by node type, Optionally in reverse.
ast
(Node
)
— mdast node;
type
(string
, optional)
— Optional node type to invoke callback
for. By default, all nodes are
visited.
callback
(function(node, index?, parent?)
)
— Callback when a node (matching type
) is found. Invoked with the node,
its index in parent
(or null
), and its parent (or null
).
Can return false
to 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.
FAQs
Deprecated
The npm package mdast-util-visit receives a total of 93 weekly downloads. As such, mdast-util-visit popularity was classified as not popular.
We found that mdast-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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.