MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / diff

Function diff

flow-debugger/debugger-ui/src/page/topology/VisGraph.js:51–71  ·  view source on GitHub ↗
(current, next, field = "id")

Source from the content-addressed store, hash-verified

49 * https://github.com/crubier/react-graph-vis/commit/68bf2e27b2046d6c0bb8b334c2cf974d23443264
50 */
51const diff = (current, next, field = "id") => {
52 const nextIds = new Set(next.map((item) => item[field]));
53 const removed = current.filter((item) => !nextIds.has(item[field]));
54 const unchanged = intersectionWith(next, current, isEqual);
55 const updated = differenceWith(
56 intersectionWith(next, current, (a, b) => a[field] === b[field]),
57 unchanged,
58 isEqual
59 );
60 const added = differenceWith(
61 differenceWith(next, current, isEqual),
62 updated,
63 isEqual
64 );
65 return {
66 removed,
67 unchanged,
68 updated,
69 added,
70 };
71};
72const defaultOptions = {
73 physics: {
74 stabilization: false,

Callers 1

VisGraph.jsFile · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected