node-source-walk
Advanced tools
Comparing version 3.0.1 to 3.0.2
46
index.js
var babylon = require('babylon'); | ||
var assign = require('object-assign'); | ||
@@ -8,22 +7,22 @@ /** | ||
module.exports = function(options) { | ||
this.options = assign({ | ||
plugins: [ | ||
'jsx', | ||
'flow', | ||
'asyncFunctions', | ||
'classConstructorCall', | ||
'doExpressions', | ||
'trailingFunctionCommas', | ||
'objectRestSpread', | ||
'decorators', | ||
'classProperties', | ||
'exportExtensions', | ||
'exponentiationOperator', | ||
'asyncGenerators', | ||
'functionBind', | ||
'functionSent' | ||
], | ||
sourceType: 'module' | ||
}, options); | ||
this.options = options || {}; | ||
this.options.plugins = this.options.plugins || [ | ||
'jsx', | ||
'flow', | ||
'asyncFunctions', | ||
'classConstructorCall', | ||
'doExpressions', | ||
'trailingFunctionCommas', | ||
'objectRestSpread', | ||
'decorators', | ||
'classProperties', | ||
'exportExtensions', | ||
'exponentiationOperator', | ||
'asyncGenerators', | ||
'functionBind', | ||
'functionSent' | ||
]; | ||
this.options.sourceType = this.options.sourceType || 'module'; | ||
// We use global state to stop the recursive traversal of the AST | ||
@@ -58,9 +57,10 @@ this.shouldStop = false; | ||
if (Array.isArray(node)) { | ||
node.forEach(function(x) { | ||
for (var i = 0, l = node.length; i < l; i++) { | ||
var x = node[i]; | ||
if (x !== null) { | ||
// Mark that the node has been visited | ||
x.parent = node; | ||
that.traverse(x, cb); | ||
this.traverse(x, cb); | ||
} | ||
}); | ||
} | ||
@@ -67,0 +67,0 @@ } else if (node && typeof node === 'object') { |
{ | ||
"name": "node-source-walk", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Execute a callback on every node of a source code's AST and stop walking when you see fit", | ||
@@ -29,4 +29,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"babylon": "~6.8.1", | ||
"object-assign": "^4.0.1" | ||
"babylon": "~6.8.1" | ||
}, | ||
@@ -33,0 +32,0 @@ "devDependencies": { |
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
5116
1
84
- Removedobject-assign@^4.0.1
- Removedobject-assign@4.1.1(transitive)