astw
walk the ast with references to parent nodes
Last updated 10 years ago by substack .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install astw 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.2.0                                ...           latest (8 years ago)

9 Versions

  • 2.2.0                                ...           8 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.0                                ...           10 years ago
  • 1.3.0                                ...           10 years ago
  • 1.2.0                                ...           11 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (2)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE