@putout/traverse
traverse ast-nodes
Last updated 5 months 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

superTraverse

import {template} from '@putout/engine-parser';
import {superTraverse} from '@putout/traverse';

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

superTraverse(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

import {template} from '@putout/engine-parser';
import {contains} from '@putout/traverse';

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

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

// returns
true;

License

MIT

Current Tags

  • 16.2.0                                ...           latest (5 months ago)

33 Versions

  • 16.2.0                                ...           5 months ago
  • 16.1.0                                ...           5 months ago
  • 16.0.0                                ...           a year ago
  • 15.0.0                                ...           a year ago
  • 14.0.0                                ...           a year ago
  • 13.0.0                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 11.1.0                                ...           2 years ago
  • 11.0.0                                ...           2 years ago
  • 10.0.1                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.1.1                                ...           3 years ago
  • 8.1.0                                ...           3 years ago
  • 8.0.3                                ...           3 years ago
  • 8.0.2                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.4                                ...           5 years ago
  • 3.0.3                                ...           5 years ago
  • 3.0.2                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.1.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.2.1                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 97
Today 1
This Week 4
This Month 64
Last Day 2
Last Week 30
Last Month 33
Dependencies (2)
Dev Dependencies (8)

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