Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 10, 2024 via pnpm

estraverse 1.8.0

ECMAScript JS AST traversal functions
Package summary
Share
2
issues
1
high severity
license
1
1
low severity
license
1
1
license
1
BSD
Package created
9 Oct 2012
Version published
19 Nov 2014
Maintainers
3
Total deps
1
Direct deps
0
License
UNKNOWN

Issues

2

1 high severity issue

high
Recommendation: Validate that the package complies with your license policy
via: estraverse@1.8.0
Collapse
Expand

1 low severity issue

low
Recommendation: Read and validate the license terms
via: estraverse@1.8.0
Collapse
Expand

Licenses

BSD

Invalid
Not OSI Approved
1 Packages, Including:
estraverse@1.8.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

0
All Dependencies CSV
β“˜ This is a list of estraverse 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does estraverse do?

Estraverse is a popular JavaScript library used for traversing ECMAScript syntax trees (ASTs). It originates from the esmangle project. This library provides functions for effectively navigating and manipulating ECMAScript ASTs, aiding developers in software tasks like code analysis and transformation.

How do you use estraverse?

Estraverse boasts an intuitive and flexible interface that developers can easily use in their code. A common use case is traversing an AST and acting upon certain node types:

estraverse.traverse(ast, {
    enter: function (node, parent) {
        if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration')
            return estraverse.VisitorOption.Skip;
    },
    leave: function (node, parent) {
        if (node.type == 'VariableDeclarator')
          console.log(node.id.name);
    }
});

In the code block above, the traverse method is used to navigate through the nodes of the AST (represented by ast). The enter function is executed when entering each node, while the leave function is invoked when exiting. By returning the VisitorOption.Skip value in enter when a FunctionExpression or FunctionDeclaration is encountered, the traversal skips over those nodes and their children.

Estraverse also has a replace function for easy tree manipulation:

result = estraverse.replace(tree, {
    enter: function (node) {
        if (node.type === 'Literal')
            return replaced;
    }
});

In this example, all nodes of type Literal are replaced with the value of the replaced variable.

Where are the estraverse docs?

Lastly, comprehensive documentation for Estraverse is available on the wiki page of the project's GitHub repository. Here you can find detailed usage guides and further examples on how to harness the functionality of the library in your projects.