abstract-syntax-tree
Advanced tools
Comparing version 2.5.0 to 2.6.0
{ | ||
"name": "abstract-syntax-tree", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "abstract syntax tree", | ||
@@ -9,5 +9,3 @@ "main": "index.js", | ||
"lint": "standard", | ||
"benchmark": "ava test/benchmarks/*.js", | ||
"coverage": "nyc npm test", | ||
"coverage:report": "nyc --reporter=text-lcov npm test > coverage.lcov && codecov" | ||
"coverage": "nyc npm test" | ||
}, | ||
@@ -37,7 +35,5 @@ "engines": { | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"benchmark": "^2.1.4", | ||
"codecov": "^3.6.1", | ||
"nyc": "^14.1.1", | ||
"standard": "^13.0.2" | ||
"ava": "^3.5.0", | ||
"nyc": "^15.0.0", | ||
"standard": "^14.3.1" | ||
}, | ||
@@ -44,0 +40,0 @@ "dependencies": { |
@@ -165,9 +165,7 @@ # abstract-syntax-tree | ||
const tree = parse(source) | ||
replace(tree, { | ||
enter (node) { | ||
if (node.type === 'VariableDeclaration') { | ||
node.kind = 'let' | ||
} | ||
return node | ||
replace(tree, node => { | ||
if (node.type === 'VariableDeclaration') { | ||
node.kind = 'let' | ||
} | ||
return node | ||
}) | ||
@@ -174,0 +172,0 @@ ``` |
@@ -19,6 +19,8 @@ const estraverse = require('estraverse') | ||
module.exports = function replace (tree, options) { | ||
const enter = typeof options === 'function' ? options : options.enter | ||
const leave = options && options.leave | ||
return estraverse.replace(tree, { | ||
enter (node, parent) { | ||
if (options.enter) { | ||
const replacement = complexReplace(options.enter, node, parent) | ||
if (enter) { | ||
const replacement = complexReplace(enter, node, parent) | ||
if (replacement) { return replacement } | ||
@@ -28,4 +30,4 @@ } | ||
leave (node, parent) { | ||
if (options.leave) { | ||
const replacement = complexReplace(options.leave, node, parent) | ||
if (leave) { | ||
const replacement = complexReplace(leave, node, parent) | ||
if (replacement) { return replacement } | ||
@@ -32,0 +34,0 @@ } |
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
3
385
26599
426