json-diff-ts icon indicating copy to clipboard operation
json-diff-ts copied to clipboard

Added key value with value "undefined"

Open gnujeremie opened this issue 5 months ago • 0 comments

Hi there,

A simple question about the following example :

 const { diff } = require('json-diff-ts');

const a = { bubu: 'bubu', newProp: undefined }
const b = { bubu: 'bubu' }

console.log(diff(b, a))
[ { type: 'ADD', key: 'newProp', value: undefined } ]

Is there a way to treat this case as "nothing changed" ?

I sometimes set some values to undefined in order to remove them from an object, so in this case diff tells me there is an update but my final objects are the same.

gnujeremie avatar Aug 18 '25 13:08 gnujeremie