jest-allure2-reporter
Version:
Idiomatic Jest reporter for Allure Framework
24 lines • 791 B
JavaScript
;
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
exports.weakMemoize = weakMemoize;
function weakMemoize(function_) {
const nullCache = new Map();
const weakCache = new WeakMap();
const memoizedFunction = ((argument) => {
if (argument == null) {
if (!nullCache.has(argument)) {
nullCache.set(argument, function_(argument));
}
return nullCache.get(argument);
}
else {
if (!weakCache.has(argument)) {
weakCache.set(argument, function_(argument));
}
return weakCache.get(argument);
}
});
return memoizedFunction;
}
//# sourceMappingURL=weakMemoize.js.map