JSPM

dash-ast

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1344133
  • Score
    100M100P100Q195419F
  • License Apache-2.0

walk an AST, quickly

Package Exports

  • dash-ast

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dash-ast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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