Make _.isEqual treat invalid dates as equiv.

This commit is contained in:
John-David Dalton
2016-05-23 15:25:31 -07:00
parent 3fdac985c7
commit c67e347255
3 changed files with 7 additions and 9 deletions

View File

@@ -5168,18 +5168,14 @@
case boolTag:
case dateTag:
// Coerce dates and booleans to numbers, dates to milliseconds and
// booleans to `1` or `0` treating invalid dates coerced to `NaN` as
// not equal.
return +object == +other;
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case numberTag:
// Treat `NaN` vs. `NaN` as equal.
return (object != +object) ? other != +other : object == +other;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,