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
.
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.
With npm do:
npm install astw
MIT
# astw walk the ast [![browser support](http://ci.testling.com/substack/astw.png)](http://ci.testling.com/substack/astw) [![build status](https://secure.travis-ci.org/substack/astw.png)](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
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19553 | swellard | Move and rename clients | ||
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/node_modules/astw/readme.markdown | |||||
#1 | 18810 | tjuricek |
First-pass at JavaScript client SDK. JavaScript requires Node with Gulp to "browserfy" the library. It's the easiest way I found to use the swagger-js project; bundle up a wrapping method. There is no JavaScript reference guide. The swagger-js doesn't really document what they do very well, actually. Overall I'm not particularly impressed by swagger-js, it was hard to even figure out what the right method syntax was. We may want to invest time in doing it better. This required setting CORS response headers, which are currently defaulted to a fairly insecure setting. |