Sha256: 55ef87f6c90eda203d52bfa4d672c6886beb80325ca3960e5faaef8443a82159
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
# astw walk the ast [](http://ci.testling.com/substack/astw) [](http://travis-ci.org/substack/astw) This module is a faster version of [falafel](https://github.com/substack/node-falafel) that only does ast walking and `.parent` tracking, not source transforms. # example ``` js 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 ``` js 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 [esprima](http://esprima.org/) but with an additional `.parent` reference to the parent node. # install With [npm](https://npmjs.org) do: ``` npm install astw ``` # license MIT
Version data entries
11 entries across 11 versions & 4 rubygems