@putout/traverse
traverse ast-nodes
Last updated 3 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/traverse 
SYNC missed versions from official npm registry.

@putout/traverse NPM version

traverse AST-nodes

Install

npm i @putout/traverse

API

traverse

const {template} = require('@putout/engine-parser');
const {traverse} = require('@putout/traverse');

const node = template.ast('const a = b');

traverse(node, {
    'Identifier'(path) {
        console.log('found identifier');
    },
    
    'throw __a'(path, {__a}) {
        console.log(__a);
    },
    
    'await __'(path) {
        console.log('found await');
    },
    'for await (__ of __) __'(path) {
        console.log('found for-of');
    },
});

contains

const {template} = require('@putout/engine-parser');
const {contains} = require('@putout/traverse');

const node = template.ast('async () => await x');

contains(node, [
    'return __',
    'throw __',
    'await __',
    'for await (__ of __) __',
]);

// returns
true;

License

MIT

Current Tags

  • 11.0.0                                ...           latest (2 months ago)

25 Versions

  • 11.0.0                                ...           2 months ago
  • 10.0.1                                ...           a year ago
  • 10.0.0                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.1.1                                ...           a year ago
  • 8.1.0                                ...           a year ago
  • 8.0.3                                ...           a year ago
  • 8.0.2                                ...           a year ago
  • 8.0.1                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.0.0                                ...           2 years ago
  • 5.0.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (10)

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