package
walk an AST, quickly
npm install dash-astGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
9.2 kB
Includes dependencies.
walk an AST, quickly
npm install dash-astvar dashAst = require('dash-ast')
var isIdentifier = require('estree-is-identifier')
var deps = []
dashAst(ast, function (node, parent) {
if (node.type === 'CallExpression' && isIdentifier(node.callee, 'require')) {
deps.push(node.arguments[0])
}
})dashAst(ast, callback)Call callback(node, parent) on each node in ast. This does a preorder traversal, i.e. callback receives child nodes after the parent node.
dashAst(ast, { enter, leave })Call enter(node, parent) on each node in ast before traversing its children, and call leave(enter, parent) on each node after traversing its children. If a node does not have children, enter() and leave() are called immediately after each other.