MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / wrapper

Function wrapper

src/util/regex.ts:16–25  ·  view source on GitHub ↗
(arg: T)

Source from the content-addressed store, hash-verified

14 const cache: Map<T, U> = new Map();
15
16 function wrapper(arg: T): U {
17 let cachedValue: U | undefined = cache.get(arg);
18
19 if (cachedValue == null) {
20 cachedValue = func(arg);
21 cache.set(arg, cachedValue);
22 }
23
24 return cachedValue;
25 }
26
27 return wrapper;
28}

Callers

nothing calls this directly

Calls 3

funcFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected