MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / memoize

Function memoize

scripts/transifex.mjs:23–35  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

21}
22
23function memoize(fn) {
24 const cache = {};
25 function wrapped(...args) {
26 const key = args.toString();
27 let result = cache[key];
28 if (!result) {
29 result = { data: fn(...args) };
30 cache[key] = result;
31 }
32 return result.data;
33 }
34 return wrapped;
35}
36
37function limitConcurrency(fn, concurrency) {
38 const tokens = [];

Callers 1

transifex.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected