* Finds all the unique common entries between aArray[aStart...aEnd] and * bArray[bStart...bEnd], inclusive. This function uses findUnique to pare * down the aArray and bArray ranges first, before then walking the * comparison between the two arrays. * * * @param aArray - The origin
(
aArray: string[],
aStart: number,
aEnd: number,
bArray: string[],
bStart: number,
bEnd: number,
)
| 82 | * matching uniqe lines. |
| 83 | */ |
| 84 | function uniqueCommon( |
| 85 | aArray: string[], |
| 86 | aStart: number, |
| 87 | aEnd: number, |
| 88 | bArray: string[], |
| 89 | bStart: number, |
| 90 | bEnd: number, |
| 91 | ): Map<string, Subsequence> { |
| 92 | const aUnique = findUnique(aArray, aStart, aEnd); |
| 93 | const bUnique = findUnique(bArray, bStart, bEnd); |
| 94 | |
| 95 | return [...aUnique.entries()].reduce<Map<string, Subsequence>>( |
| 96 | (paired, [key, value]) => { |
| 97 | const bIndex = bUnique.get(key); |
| 98 | if (bIndex !== undefined) { |
| 99 | paired.set(key, { |
| 100 | aIndex: value, |
| 101 | bIndex, |
| 102 | }); |
| 103 | } |
| 104 | return paired; |
| 105 | }, |
| 106 | new Map(), |
| 107 | ); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Takes a map from the unique common lines between two arrays and determines |
no test coverage detected