Skip to content

Documentation / @ember-data/legacy-compat / utils / isEquivId

ts
function isEquivId(expected, actual): boolean;

Defined in: utils.ts:235

Compares two IDs for strict equality, converting them to the format expected by the EmberData Cache to ensure differences in format are accounted for in the comparison.

Asserts when expected or actual are invalid IDs in dev. Expected may never be null.

js
isEquivId('1', 1); // true
isEquivId('2', '2'); // true
isEquivId(3, '3'); // true
isEquivId(4, '3'); // false
isEquivId(1, null); // false

Parameters

expected

a potentially un-normalized id to match against

string | number

actual

a potentially un-normalized id to match against

null | string | number

Returns

boolean

true if the ids are equivalent

Released under the MIT License.