h2x-traverse
Advanced tools
Comparing version 0.1.3 to 0.1.6
@@ -19,2 +19,3 @@ 'use strict'; | ||
const node = container[key]; | ||
if (!node) return null; | ||
return new NodePath({ | ||
@@ -64,2 +65,9 @@ listKey, | ||
resyncKey() { | ||
if (!this.container) return; | ||
for (let i = 0; i < this.container.length; i += 1) { | ||
if (this.container[i] === this.node) this.key = i; | ||
} | ||
} | ||
replace(node) { | ||
@@ -69,3 +77,3 @@ this.shouldStop = true; | ||
this.container[this.key] = node; | ||
this.context.visit(this.container, this.key); | ||
this.requeue(); | ||
} | ||
@@ -85,4 +93,9 @@ | ||
this.node = null; | ||
this.requeue(); | ||
} | ||
requeue() { | ||
this.context.visit(this.parent, this.listKey); | ||
} | ||
_call(fns) { | ||
@@ -89,0 +102,0 @@ if (!fns) return false; |
@@ -32,10 +32,5 @@ 'use strict'; | ||
const paths = []; | ||
Array.from(container).forEach((value, key) => { | ||
if (shouldStop) return; | ||
const nodePath = this.create(parent, container, key, listKey); | ||
paths.push(nodePath); | ||
}); | ||
paths.forEach(nodePath => { | ||
if (nodePath && nodePath.visit()) shouldStop = true; | ||
@@ -42,0 +37,0 @@ }); |
{ | ||
"name": "h2x-traverse", | ||
"description": "Traverse and modify h2x AST.", | ||
"version": "0.1.3", | ||
"version": "0.1.6", | ||
"repository": "https://github.com/smooth-code/h2x/tree/master/packages/h2x-traverse", | ||
@@ -6,0 +6,0 @@ "author": "Bergé Greg <berge.greg@gmail.com>", |
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
6321
191