MCPcopy Create free account
hub / github.com/clientdb/clientdb / weakMemoize

Function weakMemoize

core/utils/deepMap.ts:125–133  ·  view source on GitHub ↗
(
  callback: (...args: A) => R
)

Source from the content-addressed store, hash-verified

123}
124
125export function weakMemoize<A extends object[], R>(
126 callback: (...args: A) => R
127) {
128 const deepMap = createDeepMap<R>({ useWeakMap: true });
129
130 return function getMemoized(...args: A): R {
131 return deepMap.getOrCreate(args, () => callback(...args));
132 };
133}

Callers

nothing calls this directly

Calls 1

createDeepMapFunction · 0.85

Tested by

no test coverage detected