MCPcopy
hub / github.com/MisterBooo/LeetCodeAnimation / compareManifests

Function compareManifests

tools/scripts/sync-algomooc-index.js:206–213  ·  view source on GitHub ↗
(before, after)

Source from the content-addressed store, hash-verified

204}
205
206function compareManifests(before, after) {
207 const oldById = new Map(before.map((item) => [item.leetcodeId, item]));
208 const newById = new Map(after.map((item) => [item.leetcodeId, item]));
209 const added = after.filter((item) => !oldById.has(item.leetcodeId));
210 const removed = before.filter((item) => !newById.has(item.leetcodeId));
211 const changed = after.filter((item) => oldById.has(item.leetcodeId) && !sameItem(oldById.get(item.leetcodeId), item));
212 return { added, removed, changed };
213}
214
215function itemLabel(item) {
216 return `#${item.leetcodeId} ${item.titleZh} (${item.slug})`;

Callers 1

Calls 1

sameItemFunction · 0.85

Tested by

no test coverage detected