A new plain object with the keys from modified that differ from base.
Returns an empty object when the two objects are equivalent or when either argument
is null or undefined.
const prev = { x: 1, y: 2, z: 3 };
const next = { x: 1, y: 99, z: 3 };
objDiff(prev, next); // { y: 99 }
// Added keys are included
objDiff({ a: 1 }, { a: 1, b: 2 }); // { b: 2 }
// Removed keys are NOT included
objDiff({ a: 1, b: 2 }, { a: 1 }); // {}
// null / undefined values are compared strictly
objDiff({ a: null }, { a: undefined }); // { a: undefined }
Returns a shallow diff of two objects: a new object containing only the own enumerable properties from
modifiedwhose values differ from the corresponding values inbase(using strict equality!==). Properties present inmodifiedbut not inbaseare also included. Properties removed inmodified(i.e. present only inbase) are not included — use the result to describe what changed inmodified.