Skip to main content

Function: deepEquals()

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

Defined in: webxr-environment/src/equality.ts:15

Structural equality for the plain-data specs.

The director pushes a slot to the port only when that slot actually changed, which needs a comparison that does not care whether two identical specs are the same object. Specs are small, flat, JSON-shaped values - numbers, strings, booleans, number tuples and one level of object - so a compact recursive compare is exactly the right tool and there is no reason to reach for a library.

undefined and "absent" compare equal on purpose: { horizon: undefined } and {} describe the same sky, and under exactOptionalPropertyTypes the first is not even constructible from outside.

Parameters

ParameterType
aunknown
bunknown

Returns

boolean