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

esrecurse

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esrecurse

ECMAScript AST recursive visitor

  • 4.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45M
increased by10.08%
Maintainers
3
Weekly downloads
 
Created

What is esrecurse?

The esrecurse npm package is designed for recursively walking through ECMAScript/JavaScript syntax trees. It is commonly used for static analysis, code transformation, and other tasks that involve traversing and manipulating the structure of JavaScript code.

What are esrecurse's main functionalities?

Visiting nodes in an AST

This feature allows you to visit each node in an abstract syntax tree (AST) and perform actions based on the node type. In the code sample, `Literal` nodes are logged to the console.

const esrecurse = require('esrecurse');
esrecurse.visit(ast, {
  Literal(node) {
    console.log(node.value);
  }
});

Custom visitor keys

This feature allows you to define custom visitor keys for node types that are not part of the standard ECMAScript syntax. In the code sample, a `CustomNode` type is visited, and its `customProperty` is logged.

const esrecurse = require('esrecurse');
const visitorKeys = {
  CustomNode: ['customProperty']
};
esrecurse.visit(ast, {
  CustomNode(node) {
    console.log(node.customProperty);
  }
}, visitorKeys);

Other packages similar to esrecurse

FAQs

Package last updated on 31 Aug 2020

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