astw-babylon

v1.0.0
walk the ast with references to parent nodes
ast walk source babylon

astw

walk the ast

browser support

build status

This module is a faster version of falafel that only does ast walking and .parent tracking, not source transforms.

example

var astw = require('astw-babylon');
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));
});

methods

var astw = require('astw')

var walk = astw(src)

Return a walk() function from the source string or ast object src.

walk(cb)

Walk the nodes in the ast with cb(node) where node is each element in the ast from babylon but with an additional .parent reference to the parent node.

install

With npm do:

npm install astw-babylon

license

MIT

npm i astw-babylon

Metadata

  • MIT
  • Whatever
  • Jordan Klassen
  • released 8/27/2015

Downloads

Maintainers