2 ms·
https://github.com/tc39/proposal-function-memo https://github.com/tc39/proposal-function-memo This might be relevant to this exact pattern const getThing =
by fabiancook 4y ago
https://github.com/tc39/proposal-function-memo https://github.com/tc39/proposal-function-memo
This might be relevant to this exact pattern
const getThing = (async function (arg1, arg2) {
console.log({ arg1, arg2 });
return arg1 + (arg2 || 0);
}).memo();
console.log(await getThing(1)); // New promise
console.log(await getThing(2)); // New promise
console.log(await getThing(1)); // Returns promise from earlier