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.4.2 to 2.0.0

3

index.js

@@ -10,3 +10,4 @@ var acorn = require('acorn');

this.options.ecmaVersion = this.options.ecmaVersion || 5;
this.options.ecmaVersion = this.options.ecmaVersion || 6;
this.options.sourceType = this.options.sourceType || 'module';

@@ -13,0 +14,0 @@ // We use global state to stop the recursive traversal of the AST

{
"name": "node-source-walk",
"version": "1.4.2",
"version": "2.0.0",
"description": "Execute a callback on every node of a source code's AST and stop walking when you see fit",

@@ -16,4 +16,4 @@ "main": "index.js",

"traversal",
"esprima",
"acorn"
"acorn",
"static analysis"
],

@@ -27,3 +27,3 @@ "author": "Joel Kemp <joel@mrjoelkemp.com> (http://www.mrjoelkemp.com/)",

"dependencies": {
"acorn": "^1.0.3"
"acorn": "~2.0.4"
},

@@ -30,0 +30,0 @@ "devDependencies": {

@@ -29,7 +29,8 @@ ### node-source-walk [![npm](http://img.shields.io/npm/v/node-source-walk.svg)](https://npmjs.org/package/node-source-walk) [![npm](http://img.shields.io/npm/dm/node-source-walk.svg)](https://npmjs.org/package/node-source-walk)

By default, Walker will use `acorn` supporting ES5, but you can switch to es6 as follows:
By default, Walker will use `acorn` supporting ES6 and the `sourceType: module`, but you can change any of the defaults as follows:
```js
var walker = new Walker({
ecmaVersion: 6
ecmaVersion: 5,
sourceType: 'script'
});

@@ -36,0 +37,0 @@ ```

@@ -23,2 +23,10 @@ var assert = require('assert');

it('parses es6 by default', function() {
var walker = new Walker();
assert.doesNotThrow(function() {
walker.walk('() => console.log("foo")', function() {});
walker.walk('import {foo} from "bar";', function() {});
});
});
describe('walk', function() {

@@ -25,0 +33,0 @@ var parseSpy, cb;

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