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

Use triple equals for dates #61

Open JamesGelok opened 3 years ago

JamesGelok commented 3 years ago

Not sure what would need to be coerced here, triple equals might help ensure a more accurate diff.

sample source

const date1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5));

console.log(date1.valueOf());
// expected output: 823230245000

const date2 = new Date("02 Feb 1996 03:04:05 GMT");

console.log(date2.valueOf());
// expected output: 823230245000

After looking at this I'm thinking we should use triple equals here.

console.log(date1.valueOf() === date2.valueOf());
// expected output: true
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 49e621290986ce810928c68688fc4d9ebe6dd194 on JamesGelok:patch-1 into 6296889cfc0e54f08b0077460c9bf75f2febfa9f on mattphillips:master.