30 lines
870 B
JavaScript
30 lines
870 B
JavaScript
// Metro module 731 (f732).
|
|
import * as _MapCache from "./MapCache";
|
|
const memoize = function memoize(a0, a1) {
|
|
let c12481_0, c12481_1, memoized2;
|
|
L6: {
|
|
c12481_0 = a0;
|
|
c12481_1 = a1;
|
|
if (typeof a0 === "function") {
|
|
if (a1 != null && typeof a1 !== "function") {
|
|
break L6;
|
|
}
|
|
memoized2 = function memoized() {
|
|
const r3 = c12481_1 ? c12481_1.apply(this, arguments) : arguments[0];
|
|
const cache = memoized2.cache;
|
|
if (cache.has(r3)) {
|
|
return cache.get(r3);
|
|
}
|
|
const r17 = c12481_0.apply(this, arguments);
|
|
memoized2.cache = cache.set(r3, r17) || cache;
|
|
return r17;
|
|
};
|
|
memoized2.cache = new (memoize.Cache || _MapCache)();
|
|
return memoized2;
|
|
}
|
|
}
|
|
throw new TypeError("Expected a function");
|
|
};
|
|
memoize.Cache = _MapCache;
|
|
module.exports = memoize;
|