Skip to content

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

ts
function isEquivType(expected, actual): boolean;

Defined in: utils.ts:200

Compares two types 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 types in dev. Expected may never be null.

js
isEquivType('posts', 'post'); // true
isEquivType('post', 'post'); // true
isEquivType('posts', 'posts'); // true
isEquivType('post-comment', 'postComment'); // true
isEquivType('post-comment', 'PostComment'); // true
isEquivType('post-comment', 'post_comment'); // true
isEquivType('post-comment', 'post-comment'); // true
isEquivType('post-comment', 'post'); // false
isEquivType('posts', null); // false

Parameters

expected

string

a potentially unnormalized type to match against

actual

string

a potentially unnormalized type to match against

Returns

boolean

true if the types are equivalent

Released under the MIT License.