Socket
Socket
Sign inDemoInstall

@putout/traverse

Package Overview
Dependencies
26
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/traverse

traverse ast-nodes


Version published
Weekly downloads
16K
decreased by-13.93%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@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

Keywords

FAQs

Last updated on 11 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc