MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / getSimilarSourcesIndex

Function getSimilarSourcesIndex

static/history.ts:61–73  ·  view source on GitHub ↗
(completeHistory: HistoryEntry[], sourcesToCompareTo: any[])

Source from the content-addressed store, hash-verified

59}
60
61function getSimilarSourcesIndex(completeHistory: HistoryEntry[], sourcesToCompareTo: any[]): number {
62 let duplicateIdx = -1;
63
64 for (let i = 0; i < completeHistory.length; i++) {
65 const diff = _.difference(sourcesToCompareTo, getArrayWithJustTheCode(completeHistory[i].sources));
66 if (diff.length === 0) {
67 duplicateIdx = i;
68 break;
69 }
70 }
71
72 return duplicateIdx;
73}
74
75function push(stringifiedConfig: string) {
76 const config = JSON.parse(stringifiedConfig);

Callers 1

pushFunction · 0.85

Calls 1

getArrayWithJustTheCodeFunction · 0.85

Tested by

no test coverage detected