node-source-walk
Advanced tools
Comparing version 1.4.2 to 2.0.0
@@ -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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6974
144
57
+ Addedacorn@2.0.4(transitive)
- Removedacorn@1.2.2(transitive)
Updatedacorn@~2.0.4