Note about storing instances of objects
reggi opened this issue · 0 comments
reggi commented
async function fun(a) {
return new Hello(a);
}
async function fun_(a) {
return memoize.fn(fun, {}).then((memFn) => {
return memFn(a);
});
}
fun('meow').then(console.log);
fun_('meow').then(console.log);
First time this runs:
Hello { sound: 'meow' }
Hello { sound: 'meow' }
Second time this runs:
Hello { sound: 'meow' }
{ sound: 'meow' }