MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / arraysEqualShallow

Function arraysEqualShallow

packages/backend/src/utils.ts:39–54  ·  view source on GitHub ↗
(a?: readonly T[], b?: readonly T[])

Source from the content-addressed store, hash-verified

37}
38
39export const arraysEqualShallow = <T>(a?: readonly T[], b?: readonly T[]) => {
40 if (a === b) return true;
41 if (a === undefined || b === undefined) return false;
42 if (a.length !== b.length) return false;
43
44 const aSorted = a.toSorted();
45 const bSorted = b.toSorted();
46
47 for (let i = 0; i < aSorted.length; i++) {
48 if (aSorted[i] !== bSorted[i]) {
49 return false;
50 }
51 }
52
53 return true;
54}
55
56export const getShardPrefix = (orgId: number, repoId: number) => {
57 return `${orgId}_${repoId}`;

Callers 1

utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected