(
from: readonly T[],
to: readonly T[],
mapConstructor: WeakMapConstructor | MapConstructor = WeakMap,
)
| 77 | mapConstructor: MapConstructor, |
| 78 | ): [(item: T) => 'added' | null, T[]] |
| 79 | export function getStackDiffMap<T>( |
| 80 | from: readonly T[], |
| 81 | to: readonly T[], |
| 82 | mapConstructor: WeakMapConstructor | MapConstructor = WeakMap, |
| 83 | ): [(item: T) => 'added' | null, T[]] { |
| 84 | const marks: Map<T, 'added'> = new (mapConstructor as any)() |
| 85 | const allItems: T[] = [...from] |
| 86 | for (let i = allItems.length; i < to.length; i++) { |
| 87 | allItems.push(to[i]!) |
| 88 | marks.set(to[i]!, 'added') |
| 89 | } |
| 90 | return [item => marks.get(item) || null, allItems] |
| 91 | } |
no test coverage detected
searching dependent graphs…