Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: