flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

applyDiff not working if the target is undefined/null/false #163

Open ziggi opened 5 years ago

ziggi commented 5 years ago

applyDiff not working if the target is undefined/null/false but diff works well with the same target. So, I think applyDiff should works with target same as diff do (applyDiff should change the target or diff, should return null as difference).

https://playcode.io/366102

const lhs = false;
const rhs = {
  value: 'test',
};

const diff = DeepDiff.diff(lhs, rhs);
console.log('diff', diff);

DeepDiff.applyDiff(lhs, rhs);

console.log('After apply', lhs);

image

rszemplinski commented 4 years ago

+1