Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Mar 28, 2024 via pnpm

esrecurse 4.3.0

ECMAScript AST recursive visitor
Package summary
Share
0
issues
1
license
2
BSD-2-Clause
Package created
2 Dec 2014
Version published
31 Aug 2020
Maintainers
3
Total deps
2
Direct deps
1
License
BSD-2-Clause

Issues

0
This package has no issues

Licenses

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
esrecurse@4.3.0
estraverse@5.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of esrecurse 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
estraverse5.3.07.86 kBBSD-2-Clause
prod

Visualizations

Frequently Asked Questions

What does esrecurse do?

Esrecurse is a JavaScript package, specifically designed for parsing ECMAScript, which provides recursive traversing functionality. It's a powerful tool for navigating and analyzing the abstract syntax tree (AST) of your JavaScript code.

How do you use esrecurse?

To use esrecurse, you can call the visit function with your AST and a visitor object that defines methods for the types of nodes you're interested in. For instance, to visit all variables declared at the root of a file, your code would look like this:

esrecurse.visit(ast, {
    VariableDeclaration: function (node) {
        this.visit(node.init);
        // Further operations...
    }
});

Alternatively, you can create a Visitor instance:

var visitor = new esrecurse.Visitor({
    VariableDeclaration: function (node) {
        this.visit(node.init);
        // Further operations...
    }
});

visitor.visit(ast);

If you want to customize the Visitor object, esrecurse allows for easy instantiation of Visitor instances:

class MyVisitor extends esrecurse.Visitor {
    constructor()
    {
        super(null);
    }
}

MyVisitor.prototype.VariableDeclaration = function (node) {
    this.visit(node.init);
    // Further operations...
};

To override the default visiting operation, you can call the visitChildren(node) function from within your custom visitor methods:

MyVisitor.prototype.VariableDeclaration = function(node) {
    this.visitChildren(node);
};

Esrecurse also supports user-defined node types and provides options to handle unknown nodes with the fallback option. In addition to the standard visit function, there are also various methods and options for customizing behavior, including user-defined node types and visiting unknown nodes.

Where are the esrecurse docs?

Documentation of esrecurse can be found on its GitHub page. Here, you will find all the essential information on how to use the package, options, examples, and so on. For an in-depth exploration of using esrecurse and understanding its features, the source code provides the most detailed insights.