versatile-tree
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -617,22 +617,15 @@ "use strict"; | ||
walk(visit, rightToLeft) { | ||
const abort = !!visit(this); | ||
let abort = !!visit(this); | ||
if (!abort) { | ||
if (rightToLeft) { | ||
for (let i = this.children.length - 1; i >= 0; i--) { | ||
const childNode = this.children[i]; | ||
const abortChild = childNode.walk(visit, rightToLeft); | ||
if (abortChild) { | ||
break; | ||
} | ||
let i = rightToLeft ? this.children.length - 1 : 0; | ||
const condition = () => (rightToLeft ? i >= 0 : i < this.children.length); | ||
const update = () => (rightToLeft ? i-- : i++); | ||
while (condition()) { | ||
const childNode = this.children[i]; | ||
abort = childNode.walk(visit, rightToLeft); | ||
if (abort) { | ||
break; | ||
} | ||
update(); | ||
} | ||
else { | ||
for (let i = 0; i < this.children.length; i++) { | ||
const childNode = this.children[i]; | ||
const abortChild = childNode.walk(visit, rightToLeft); | ||
if (abortChild) { | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
@@ -639,0 +632,0 @@ return abort; |
{ | ||
"name": "versatile-tree", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": "Justin Mahar <contact@justinmahar.com>", | ||
@@ -5,0 +5,0 @@ "description": "A highly versatile tree structure for JavaScript.", |
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
147230
1388