44 lines
1 KiB
JavaScript
44 lines
1 KiB
JavaScript
// Module ID: 731
|
|
// Function ID: 732
|
|
// Name: memoize
|
|
// Dependencies: [732]
|
|
|
|
// Module 731 (memoize)
|
|
import MapCache from "MapCache" /* 732 */;
|
|
|
|
function memoize(fn, fn2) {
|
|
const _require = fn;
|
|
dependencyMap = fn2;
|
|
if (typeof fn === "function") {
|
|
function memoized() {
|
|
const self = this;
|
|
if (closure_1) {
|
|
let applyResult = obj(...arguments);
|
|
} else {
|
|
applyResult = arguments[0];
|
|
}
|
|
const cache = memoized.cache;
|
|
if (cache.has(applyResult)) {
|
|
return cache.get(applyResult);
|
|
} else {
|
|
const applyResult1 = callback(...arguments);
|
|
tmp4.cache = cache.set(applyResult, applyResult1) || cache;
|
|
return applyResult1;
|
|
}
|
|
obj = closure_1;
|
|
tmp4 = memoized;
|
|
}
|
|
let Cache = memoized.Cache;
|
|
if (!Cache) {
|
|
Cache = _require(732);
|
|
}
|
|
let cache = new Cache();
|
|
memoized.cache = cache;
|
|
return memoized;
|
|
}
|
|
const typeError = new TypeError("Expected a function");
|
|
throw typeError;
|
|
}
|
|
memoize.Cache = MapCache;
|
|
|
|
export default memoize;
|