Socket
Socket
Sign inDemoInstall

@snyk/dep-graph

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/dep-graph - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

33

dist/core/dep-graph.js

@@ -109,3 +109,10 @@ "use strict";

for (const nodeId of this.getPkgNodeIds(pkg)) {
count += this.countNodePathsToRoot(nodeId);
if (this._countNodePathsToRootCache.has(nodeId)) {
count += this._countNodePathsToRootCache.get(nodeId);
}
else {
const c = this.countNodePathsToRoot(nodeId);
this._countNodePathsToRootCache.set(nodeId, c);
count += c;
}
}

@@ -258,19 +265,13 @@ return count;

}
countNodePathsToRoot(nodeId, ancestors = []) {
if (ancestors.includes(nodeId)) {
return 0;
countNodePathsToRoot(nodeId, visited = []) {
if (nodeId === this._rootNodeId) {
return 1;
}
if (this._countNodePathsToRootCache.has(nodeId)) {
return this._countNodePathsToRootCache.get(nodeId) || 0;
visited = visited.concat(nodeId);
let count = 0;
for (const parentNodeId of this.getNodeParentsNodeIds(nodeId)) {
if (!visited.includes(parentNodeId)) {
count += this.countNodePathsToRoot(parentNodeId, visited);
}
}
const parentNodesIds = this.getNodeParentsNodeIds(nodeId);
if (parentNodesIds.length === 0) {
this._countNodePathsToRootCache.set(nodeId, 1);
return 1;
}
ancestors = ancestors.concat(nodeId);
const count = parentNodesIds.reduce((acc, parentNodeId) => {
return acc + this.countNodePathsToRoot(parentNodeId, ancestors);
}, 0);
this._countNodePathsToRootCache.set(nodeId, count);
return count;

@@ -277,0 +278,0 @@ }

@@ -71,3 +71,3 @@ {

},
"version": "2.6.0"
"version": "2.6.1"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc