Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-source-walk

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-source-walk - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

19

index.js
var esprima = require('esprima');
var esprimaHarmony = require('esprima-fb');
module.exports = function () {
// We use global state to stop the recursive
// traversal of the AST
/**
* @param {Object} options
* @param {Boolean} [options.esprimaHarmony=false]
*/
module.exports = function (options) {
options = options || {};
// We use global state to stop the recursive traversal of the AST
this.shouldStop = false;
if (options.esprimaHarmony) {
esprima = esprimaHarmony;
}
};

@@ -18,3 +27,3 @@

node.forEach(function (x) {
if(x != null) {
if(x !== null) {
// Mark that the node has been visited

@@ -52,2 +61,2 @@ x.parent = node;

this.shouldStop = true;
};
};
{
"name": "node-source-walk",
"version": "1.1.2",
"version": "1.2.0",
"description": "Execute a callback on every node of a source code's AST and stop walking when you see fit",

@@ -24,4 +24,5 @@ "main": "index.js",

"dependencies": {
"esprima": "~1.0.4"
"esprima": "~1.0.4",
"esprima-fb": "~7001.1.0-dev-harmony-fb"
}
}

@@ -1,3 +0,2 @@

Execute a callback on every node of a source code's AST and
stop walking whenever you see fit.
Execute a callback on every node of a source code's AST and stop walking whenever you see fit.

@@ -36,2 +35,10 @@ *A variation of [substack/node-detective](https://github.com/substack/node-detective)

By default, Walker will use `esprima`, but you can switch to `esprima-fb` (harmony branch) as follows:
```js
var walker = new Walker({
esprimaHarmony: true
});
```
### Public Members

@@ -52,2 +59,2 @@

* Allows you to traverse an AST node and execute a callback on it
* Callback should expect the first argument to be an AST node, similar to `walk`'s callback.
* Callback should expect the first argument to be an AST node, similar to `walk`'s callback.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc