Skip to content

Added key value with value "undefined" #330

@gnujeremie

Description

@gnujeremie

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions