flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The DeepDiff.diff is coming out as undefined

CodingBroSr opened this issue · comments

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

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

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.