npm

Need private packages and team management tools?Check out npm Orgs. »

estree-visitor

1.0.8 • Public • Published

ESTree-visitor

Traverse through Javascript AST as described by ESTree-spec.

Installation / Usage

Run npm i estree-visitor

Visitor accepts an optional enter function so you can play around with current ESTree node you are on!

const visitor = require("estree-visitor");
const acorn = require("acorn");

const statement = "console.log('hello')"; // pass any JS code
const ast = acorn.parse(statement);
visitor(ast, {
  enter: function(currentNode) {
    console.log("current node: ", currentNode);
    // do more stuff with currentNode
  }
});

Example

Check out the demo folder for an example.

cd demo
npm i
npm run start-demo // will run on localhost:1234

License

MIT

install

npm i estree-visitor

Downloadsweekly downloads

3

version

1.0.8

license

mit

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability