|
|
|
|
|
by fabiancook
1427 days ago
|
|
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
|
|