MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / getStackDiffMap

Function getStackDiffMap

packages/logger/src/utils.ts:79–91  ·  view source on GitHub ↗
(
    from: readonly T[],
    to: readonly T[],
    mapConstructor: WeakMapConstructor | MapConstructor = WeakMap,
)

Source from the content-addressed store, hash-verified

77 mapConstructor: MapConstructor,
78): [(item: T) => 'added' | null, T[]]
79export 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}

Callers 1

logOwnersDiffFunction · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…