mattphillips / deep-object-diff

Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️

Home Page:https://www.npmjs.com/package/deep-object-diff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A better way to test for changes

robcdd opened this issue · comments

https://github.com/mattphillips/deep-object-diff/blob/a24d61fea6d6d644fc3e32a853f685953d6d5b41/src/added.js#LL5C1-L5C1

  if (lhs === rhs || !isObject(lhs) || !isObject(rhs)) return {};

If we could return null here, so that in detailedDiff we could receive added: null, it would be very easy to see that nothing was added. Currently is seems that we have to use Object.keys(diff.added).length to find out if anything was added. Same for deleted and updated.