This problem:
let mightChange = {id:1}
const doWork = async v => {
const result1 = await doSomethingWith(mightChange);
const result2 = await doAnotherThingWith(mightChange); // mightChange.id might be mutated
return doSomething(result2)
};
is the same problem as:
const doWork = async (v,cb) => {
doSomethingWith(mightChange, (err, v) => {
doAnotherThingWith(mightChange, (err,v) => { // mightChange.id might be mutated
doSomething(v,cb)
})
});
};