fast-deep-equal
fast-deep-equal copied to clipboard
Feature request: ignore undefined values
in version 3.1.3 of the library the following comparison returns false
equal({ a: undefined }, {})
That's quite a surprise for me, but since there are test-cases for this case, I guess it works as expected.
It would be good to have an option to ignore undefined
values.
This comparison has to be falsy since your second object does not contain the a
property, its working as intended imo.
Yes, technically they are different, but semantically they may be equal: i.e. a missing property and a property with the value undefined
often mean the same thing: For example, look at the output of JSON.stringify()
-
JSON.stringify({}) = {}
-
JSON.stringify({a:undefined}) = {}
The result is the same. So in this case, so equals
should return true
.