Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

defnode

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defnode

maps JavaScript Identifier AST nodes to/from their corresponding definition nodes

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

defnode

xrefs funcs top func library users status

defnode is a node.js package that maps JavaScript Identifier AST nodes to/from their corresponding definition nodes. It is useful in tools that perform JavaScript source introspection.

For example, suppose we have the following code.

function a(b) {
  var c = 1, d;
}

defnode maps the following Identifier/definition pairs:

  • a to/from the enclosing FunctionDeclaration node
  • b to/from itself (since its Identifier node is its own declaration)
  • c to/from its VariableDeclarator node
  • d to/from its VariableDeclarator node

defnode uses marijnh/tern, but it should work with any SpiderMonkey API-compliant JavaScript AST.

Documentation: defnode.js on Sourcegraph

Running tests

Run npm test.

Contributors

FAQs

Package last updated on 22 Jan 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc