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

Function diffSets

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

Source from the content-addressed store, hash-verified

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

Callers 1

kernel-parity.mjsFile · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected