mattphillips / deep-object-diff

Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
https://www.npmjs.com/package/deep-object-diff
MIT License
1.05k stars 89 forks source link

delete return value #2

Closed edwardsmarkf closed 7 years ago

edwardsmarkf commented 7 years ago

could we include this gist with deep-object-diff and use a parameter with detailedDifference( function?

something like:

detailedDifference(lhs, rhs, null);   // return null rather than undefined
detailedDifference(lhs, rhs, '{}' ) ;   // return {} rather than undefined
mattphillips commented 7 years ago

I think the value of undefined has the correct semantic meaning in that the value has been deleted and is now undefined. This change would also mean changing the API for 2 of the 5 available functions (deletedDiff and detailedDiff) which ideally would all remain the same.

I've just updated the gist to use the correct variable name on line 32 - which shows how to map the undefined values to a null.