apps-script-utils 2.1.1 Help

equals

function equals(a: unknown, b: unknown): boolean;

Objects and arrays are walked key by key, dates by their instant, and primitives by SameValueZero — so NaN equals NaN, which === never grants. A value carrying its own equals method is asked instead of being taken apart.

Cycles are tolerated: a structure that refers back to itself is compared without looping.

Parameters

Parameter

Type

Description

a

unknown

The first value.

b

unknown

The second value.

Returns

boolean — true when the two are equal all the way down.

Examples

Comparing

equals({ a: 1 }, { a: 1 }); // => true equals([1, { a: 2 }], [1, { a: 2 }]); // => true equals(NaN, NaN); // => true equals(new Date(0), new Date(0)); // => true

See also

Source

src/lang/object/equals.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.