backoffice/node_modules/astw
root ab9f8bb658 first commit 2020-02-06 10:09:39 +00:00
..
example first commit 2020-02-06 10:09:39 +00:00
test first commit 2020-02-06 10:09:39 +00:00
.travis.yml first commit 2020-02-06 10:09:39 +00:00
LICENSE first commit 2020-02-06 10:09:39 +00:00
index.js first commit 2020-02-06 10:09:39 +00:00
package.json first commit 2020-02-06 10:09:39 +00:00
readme.markdown first commit 2020-02-06 10:09:39 +00:00

readme.markdown

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');
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, opts={})

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

Optionally:

  • opts.ecmaVersion - default: 8

walk(cb)

Walk 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.

install

With npm do:

npm install astw

license

MIT