Is there an alternative/quick way to keep the same object reference when doing JS spread operator ? Instead of manually copying the fields ?
function copy(arg) {
let state = { ...arg };
console.assert(state === arg);
// assertion failed because state is a different object
}
a = { k1: 1, k2: 2 };
copy(a);