@zdychacek/astw

3.0.2 • Public • Published

astw

This is a fork of astw which uses Babylon parser instead of acorn.

Walks the AST.

example

var astw = require('../');
var walk = astw('4 + beep(5 * 2)');

walk(function (node) {
    console.log(node);
});

methods

var astw = require('@zdychacek/astw')

var walk = astw(src, opts={})

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

Optionally:

  • opts.parserPlugins - list of plugins for Babylon parser

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 @zdychacek/astw

license

MIT

Readme

Keywords

Package Sidebar

Install

npm i @zdychacek/astw

Weekly Downloads

1

Version

3.0.2

License

MIT

Last publish

Collaborators

  • zdychacek