Socket
Socket
Sign inDemoInstall

dash-ast

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dash-ast

walk an AST, quickly


Version published
Weekly downloads
1.6M
increased by0.21%
Maintainers
1
Install size
10.0 kB
Created
Weekly downloads
 

Changelog

Source

2.0.1

  • Remove obsolete .withParent() documentation from the readme.

Readme

Source

dash-ast

walk an AST, quickly

npm travis standard

Install

npm install dash-ast

Usage

var dashAst = require('dash-ast')
var isIdentifier = require('estree-is-identifier')

var deps = []
dashAst(ast, function (node, parent) {
  if (node.type === 'CallExpression' && isIdentifier(node.callee, 'require')) {
    deps.push(node.arguments[0])
  }
})

API

dashAst(ast, callback)

Call callback(node, parent) on each node in ast. This does a preorder traversal, i.e. callback receives child nodes after the parent node.

dashAst(ast, { enter, leave })

Call enter(node, parent) on each node in ast before traversing its children, and call leave(enter, parent) on each node after traversing its children. If a node does not have children, enter() and leave() are called immediately after each other.

License

Apache-2.0

Keywords

FAQs

Last updated on 11 Mar 2020

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