New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graph-cache

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graph-cache - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

9

lib/update_graph.js

@@ -32,3 +32,3 @@ const diff = require('lodash.differenceby');

function walkTogether(nwg, g, leafs) {
function walkTogether(nwg, g, leafs, walked) {
let nextLeafs = [];

@@ -38,2 +38,3 @@ leafs.forEach(([leaf, parent]) => {

const oldPred = g.predecessors(leaf) || [];
walked[leaf] = true;
nextLeafs = nextLeafs.concat(curPred.map(el => [el, leaf]));

@@ -59,2 +60,4 @@ if (!nwg.node(leaf)) {

});
nextLeafs = nextLeafs.filter(([el]) => !walked[el]);

@@ -64,3 +67,3 @@ if (nextLeafs.length === 0) {

}
return walkTogether(nwg, g, nextLeafs);
return walkTogether(nwg, g, nextLeafs, walked);
}

@@ -70,3 +73,3 @@

return parse(sign, file, filename).then(nwg =>
walkTogether(nwg, g, [[filename, null]], false));
walkTogether(nwg, g, [[filename, null]], {}));
}

@@ -73,0 +76,0 @@

{
"name": "graph-cache",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,2 +14,3 @@ const chai = require('chai');

compareGraphs,
loadCyclicGraph
} = require('../utils/test_utils');

@@ -149,2 +150,11 @@ const { loadFile } = require('../../lib/file_process');

it('handles cyclic graphs', () =>
load2Graph().then(g =>
loadCyclicGraph().then(gg => {
return updateGraph(g, testSign, loadCyclicGraph, '', getName(1))
.then(nwg => compareGraphs(nwg, gg))
})
)
);
it('if subgraph is empty, will remove leaf and nodes with no connection', () =>

@@ -151,0 +161,0 @@ load2Graph(true).then(([g]) =>

@@ -90,2 +90,9 @@ const Graph = require('graphlib').Graph;

function loadCyclicGraph() {
return load2Graph().then((g) => {
g.setEdge(getName(1), getName(2));
return g;
});
}
function compareGraphs(g, nwg) {

@@ -113,2 +120,3 @@ const nodes1 = g.nodes().sort().map(node => [node, g.node(node)]);

compareGraphs,
loadCyclicGraph,
};
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