| 55 | } |
| 56 | |
| 57 | function valuesMatching<V>( |
| 58 | liveIdx: number, |
| 59 | liveValue: V, |
| 60 | newIdx: number, |
| 61 | newValue: V, |
| 62 | trackBy: TrackByFunction<V>, |
| 63 | ): number { |
| 64 | if (liveIdx === newIdx && Object.is(liveValue, newValue)) { |
| 65 | // matching and no value identity to update |
| 66 | return 1; |
| 67 | } else if (Object.is(trackBy(liveIdx, liveValue), trackBy(newIdx, newValue))) { |
| 68 | // matching but requires value identity update |
| 69 | return -1; |
| 70 | } |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | function recordDuplicateKeys(keyToIdx: Map<unknown, Set<number>>, key: unknown, idx: number): void { |
| 76 | const idxSoFar = keyToIdx.get(key); |