UNPKG

moltres-utils

Version:
26 lines (21 loc) 573 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ramda = require("ramda"); const weakMemoizeWith = (0, _ramda.curryN)(2, (mFn, fn) => { const cache = new WeakMap(); return (0, _ramda.nAry)(fn.length, (...args) => { const key = mFn(...args); if (!cache.has(key)) { const result = fn(...args); cache.set(key, result); return result; } return cache.get(key); }); }); var _default = weakMemoizeWith; exports.default = _default; //# sourceMappingURL=weakMemoizeWith.js.map