MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / memoizeStringFn

Function memoizeStringFn

dashboard/src/utils/pluginSearch.js:13–26  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

11 normalizeLooseFromNormalized(normalizeStr(s));
12
13const memoizeStringFn = (fn) => {
14 const cache = new Map();
15
16 return (raw) => {
17 const key = (raw ?? "").toString();
18 if (cache.has(key)) {
19 return cache.get(key);
20 }
21
22 const value = fn(key);
23 cache.set(key, value);
24 return value;
25 };
26};
27
28const getNormalizedText = memoizeStringFn(normalizeStr);
29

Callers 1

pluginSearch.jsFile · 0.85

Calls 4

fnFunction · 0.85
toStringMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected