flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

The DeepDiff.diff is coming out as undefined #132

Closed CodingBroSr closed 7 months ago

CodingBroSr commented 6 years ago

import * as DeepDiff from 'deep-diff';

static checkForChange(oldData: DdmForm, newData: DdmForm) {
var diffrence = DeepDiff.diff(oldData, newData);
console.log(diffrence); return diffrence; }

I tested DeepDiff.diff with Runkit. it works fine there. But here the diffrence is always coming as undefined. though oldData and newData are not undefined

fasiha commented 4 years ago

Ran into the case where if oldData and newData are both exactly the same, diff returns undefined: in Runkit:

var deepDiff = require("deep-diff")
console.log(deepDiff({b:94,a:10}, {b:94,a:10})) // undefined
cerebralkungfu commented 7 months ago

By design. Seemed reasonable at the time I wrote it. Breaking changes in v2.x (as time allows) will fix this to work more naturally.