API reference@evolu/commonEq › eqSameValueZero

function eqSameValueZero<A>(x: A, y: A): boolean;

Defined in: packages/common/src/Eq.ts:67

Compares two values using SameValueZero equality.

SameValueZero is the standard equality algorithm used by Map, Set, and Array.prototype.includes. It behaves like strict equality except that NaN equals itself. Both algorithms consider 0 and -0 equal.

Example

import { eqSameValueZero } from "@evolu/common";

expect(eqSameValueZero(NaN, NaN)).toBe(true);
expect(eqSameValueZero(0, -0)).toBe(true);
expect(eqSameValueZero({}, {})).toBe(false);