topological-sort
Advanced tools
Comparing version 0.1.0 to 0.1.1
11
index.js
@@ -37,8 +37,6 @@ 'use strict'; | ||
this._sortedKeysStack = []; | ||
this._pickNodes = new Set; | ||
const output = new Map; | ||
for (const [key] of this._nodes) { | ||
this._pickNodes.add(key); | ||
this._exploreNode(key, [key], true); | ||
this._exploreNode(key, [key]); | ||
} | ||
@@ -53,5 +51,6 @@ | ||
_exploreNode(nodeKey, explorePath, skipCurrentNodeCheck = false) { | ||
if (!skipCurrentNodeCheck) { | ||
assert(!this._pickNodes.has(nodeKey), `Node ${nodeKey} forms circular dependency: ${explorePath.join(' -> ')}`); | ||
_exploreNode(nodeKey, explorePath) { | ||
// we should check circular dependencies starting from node 2 | ||
if (explorePath.length > 1) { | ||
assert(nodeKey !== explorePath[0], `Node ${nodeKey} forms circular dependency: ${explorePath.join(' -> ')}`); | ||
} | ||
@@ -58,0 +57,0 @@ |
{ | ||
"name": "topological-sort", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Topological sort implemented in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
5864
71