MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / diffSets

Function diffSets

scripts/kernel-parity.mjs:165–181  ·  view source on GitHub ↗
(aList, bList)

Source from the content-addressed store, hash-verified

163}
164
165function diffSets(aList, bList) {
166 const a = new Map(); // canon -> count (multiset — duplicates matter)
167 const b = new Map();
168 for (const x of aList) a.set(x, (a.get(x) ?? 0) + 1);
169 for (const x of bList) b.set(x, (b.get(x) ?? 0) + 1);
170 const onlyA = [];
171 const onlyB = [];
172 for (const [k, c] of a) {
173 const d = c - (b.get(k) ?? 0);
174 for (let i = 0; i < d; i++) onlyA.push(k);
175 }
176 for (const [k, c] of b) {
177 const d = c - (a.get(k) ?? 0);
178 for (let i = 0; i < d; i++) onlyB.push(k);
179 }
180 return { onlyA, onlyB };
181}
182
183// --- run ----------------------------------------------------------------------
184const buckets = new Map(); // category -> {count, samples[]}

Callers 1

kernel-parity.mjsFile · 0.85

Calls 3

pushMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected