Installations
npm install @timeax/estree-walker
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
14.17.6
NPM Version
6.14.15
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Rich-Harris
Download Statistics
Total Downloads
970
Last Day
1
Last Week
3
Last Month
18
Last Year
191
GitHub Statistics
397 Stars
112 Commits
38 Forks
5 Watching
1 Branches
14 Contributors
Bundle Size
3.86 kB
Minified
971.00 B
Minified + Gzipped
Package Meta Information
Latest Version
3.0.1
Package Id
@timeax/estree-walker@3.0.1
Unpacked Size
23.90 kB
Size
4.91 kB
File Count
12
NPM Version
6.14.15
Node Version
14.17.6
Total Downloads
Cumulative downloads
Total Downloads
970
Last day
0%
1
Compared to previous day
Last week
0%
3
Compared to previous week
Last month
500%
18
Compared to previous month
Last year
-68.7%
191
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
estree-walker
Simple utility for walking an ESTree-compliant AST, such as one generated by acorn. Commonsjs version.
Installation
1npm i estree-walker
Usage
1var walk = require('estree-walker').walk; 2var acorn = require('acorn'); 3 4ast = acorn.parse(sourceCode, options); // https://github.com/acornjs/acorn 5 6walk(ast, { 7 enter(node, parent, prop, index) { 8 // some code happens 9 }, 10 leave(node, parent, prop, index) { 11 // some code happens 12 } 13});
Inside the enter
function, calling this.skip()
will prevent the node's children being walked, or the leave
function (which is optional) being called.
Call this.replace(new_node)
in either enter
or leave
to replace the current node with a new one.
Call this.remove()
in either enter
or leave
to remove the current node.
Why not use estraverse?
The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where estraverse was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys.
estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.)
None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful.
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
Found 4/20 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 15 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More