{"name":"estree-walker","description":"Traverse an ESTree-compliant AST","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.2":{"name":"estree-walker","description":"Traverse an ESTree-compliant AST","version":"2.0.2","private":false,"author":{"name":"Rich Harris"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/estree-walker.git"},"type":"commonjs","main":"./dist/umd/estree-walker.js","module":"./dist/esm/estree-walker.js","exports":{"require":"./dist/umd/estree-walker.js","import":"./dist/esm/estree-walker.js"},"types":"types/index.d.ts","scripts":{"prepublishOnly":"npm run build && npm test","build":"tsc && rollup -c","test":"uvu test"},"devDependencies":{"@types/estree":"0.0.42","rollup":"^2.10.9","typescript":"^3.7.5","uvu":"^0.5.1"},"gitHead":"3ac96d685ddedb1701009945d9911fa41d60b0ce","bugs":{"url":"https://github.com/Rich-Harris/estree-walker/issues"},"_id":"estree-walker@2.0.2","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==","shasum":"52f010178c2a4c117a7757cfe942adb7d2da4cac","tarball":"http://localhost:4260/estree-walker/estree-walker-2.0.2.tgz","fileCount":17,"unpackedSize":50243,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfz7LfCRA9TVsSAnZWagAAIHEP/3W5C8KLN5INJg2Zrvn/\ns1sQstVkA8NVw1f006STezOgzzLmH1WilQ17juF0f5OzY5JN+N14NhOnaxfV\ndC/+wSKiQKtEzyIjM/odxE1V4TJo3O08JdyFW8wJRD+AdcHmojLpbit5uN8i\ncI/gJZQKN44q28AGEtwjy8aMS+iOsH24WuA9VLJ62h4DVsjQYkMttRPGRgtF\nKPGnWsw2Ng43TPJqHy9Iqrk6Y3ukmLfssimVn4W1Yxc16RCg1z43B9w3Nmk6\n49UKiiYEO6+EqFsk6trDzwwtJOL1yhnB7dkreU1TQBkEhCB7rmmKQJin/LXm\nKisS9T60V9mB4bRtaDQVLylLSz6u9y93VAfkndcv5byt4EQiF5E6AEO4Jo0v\n7hoOWF1qxxvLH9u4KBJXPBw9eL/2oXYWwCfc/+ycUKISwv8vWbyHRRZgUstu\nspZpCLTUfWvK2sA1O0iy3VquX+bCWwTSagY4b5ZkwHb1CW8ADwU+piWELfZL\nuwI7gdRZuNjFmQko3YlkY+3icLae9osHNM34TqmakoSYicGp+ERgzeJGXO/O\nX95LDk1bJctUs64H7xv+MNQ7z4xWL43jfcBzEu93KsH3nMTi3Qh8+uV7mrtN\nWzobbyTErFKhS14YsGIgr3SEPbGxq4vHSWCCNzHMqh1+PKc4CqxrhJlEHjiI\nAjXr\r\n=0OBC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTgIR8c6jabJ8AGPJD/b/bX5gFjDsPTspyhM1CukcRCAiEA71mt+FxZ8yX3AoQFDOmB3QcQ4MFR3+dKqKIsSYhavb8="}]},"directories":{},"_hasShrinkwrap":false}},"readme":"# estree-walker\n\nSimple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn).\n\n\n## Installation\n\n```bash\nnpm i estree-walker\n```\n\n\n## Usage\n\n```js\nvar walk = require('estree-walker').walk;\nvar acorn = require('acorn');\n\nast = acorn.parse(sourceCode, options); // https://github.com/acornjs/acorn\n\nwalk(ast, {\n enter(node, parent, prop, index) {\n // some code happens\n },\n leave(node, parent, prop, index) {\n // some code happens\n }\n});\n```\n\nInside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called.\n\nCall `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one.\n\nCall `this.remove()` in either `enter` or `leave` to remove the current node.\n\n## Why not use estraverse?\n\nThe ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys.\n\nestree-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.)\n\nNone 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.\n\n\n## License\n\nMIT\n","author":{"name":"Rich Harris"},"license":"MIT