Skip to main content

deep_strict_eq

Function deep_strict_eq 

Source
pub fn deep_strict_eq(a: &ParseValue, b: &ParseValue) -> bool
Expand description

Deep equality with Node’s util.isDeepStrictEqual semantics.

Two float cases differ from what a derived PartialEq would do, and both are reachable: Node compares primitives with Object.is, so NaN equals NaN and +0.0 does not equal -0.0. JSON.parse("-0") yields -0, and a stored BSON double can be -0, so this is not theoretical.

Note the deliberate tension with the encoder: -0.0 and 0.0 compare as distinct here and serialize identically (both as 0). Both are correct, and both must hold at once.