package
walk the ast with references to parent nodes
npm install astwGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
555.2 kB
Includes dependencies.
walk the ast
This module is a faster version of
falafel
that only does ast walking and .parent tracking, not source transforms.
var astw = require('astw');
var deparse = require('escodegen').generate;
var walk = astw('4 + beep(5 * 2)');
walk(function (node) {
var src = deparse(node);
console.log(node.type + ' :: ' + JSON.stringify(src));
});var astw = require('astw')Return a walk() function from the source string or ast object src.
Optionally:
opts.ecmaVersion - default: 8Walk the nodes in the ast with cb(node) where node is each element in the
ast from esprima but with an additional .parent
reference to the parent node.
With npm do:
npm install astwMIT