@snyk/dep-graph
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -15,2 +15,3 @@ import * as graphlib from 'graphlib'; | ||
private _countNodePathsToRootCache; | ||
private _hasCycles; | ||
constructor(graph: graphlib.Graph, rootNodeId: string, pkgs: { | ||
@@ -17,0 +18,0 @@ [pkgId: string]: types.PkgInfo; |
@@ -71,3 +71,7 @@ "use strict"; | ||
DepGraphImpl.prototype.hasCycles = function () { | ||
return !graphlib.alg.isAcyclic(this._graph); | ||
// `isAcyclic` is expensive, so memoize | ||
if (this._hasCycles === undefined) { | ||
this._hasCycles = !graphlib.alg.isAcyclic(this._graph); | ||
} | ||
return this._hasCycles; | ||
}; | ||
@@ -74,0 +78,0 @@ DepGraphImpl.prototype.pkgPathsToRoot = function (pkg) { |
@@ -49,3 +49,3 @@ { | ||
}, | ||
"version": "1.5.0" | ||
"version": "1.5.1" | ||
} |
Sorry, the diff of this file is not supported yet
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
61141
861