
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Provides a set of utility function to traverse, filter and map esprima ASTs
Estools provides a set of utility functions to traverse, filter and map esprima ASTs.
npm install estools --save
var estools = require('estools')
Traverses all tree nodes of an AST and calls visitor functions passing the AST node.
ast is the result of esprima.parse, visitor may be a function or a visitor object.
The visitor object may define the following functions
Called when entering a node. The current node and parent node are passed as parameter
Example
traverse(ast, {
enter : function(node, parent) {
console.log(node.type); // Print the node type to std out
}
});
Called when leaving a node. The current node and parent node are passed as parameter
Example
traverse(ast, {
leave : function(node, parent) {
console.log(node.type); // Print the node type to std out
}
});
Called after enter
and before leave
. The current node and a parent node are passed as parameter. Additionally
a function next
is passed. The visit
function is responsible to call next
to visit child nodes. To skip
child nodes just omit the call to visit
.
Example
traverse(ast, {
visit : function(node, parent, next) {
next();
}
});
Example skipping nodes traverse(ast, { visit : function(node, parent, next) { if (node.type != 'FunctionExpression') { // Skip child nodes of function expressions next(); } } });
Filters AST nodes and returns matching AST nodes as a flat list.
Maps ASTs and nodes to a normalized tree with node having child nodes stored in a nodes field array.
FAQs
Provides a set of utility function to traverse, filter and map esprima ASTs
The npm package estools receives a total of 1 weekly downloads. As such, estools popularity was classified as not popular.
We found that estools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.