UNPKG

467 BJavaScriptView Raw
1import { get } from '@ember/object';
2
3/**
4 @module @ember-data/serializer
5*/
6
7/*
8 Check if the passed model has a `type` attribute or a relationship named `type`.
9
10 @method modelHasAttributeOrRelationshipNamedType
11 @param modelClass
12 */
13function modelHasAttributeOrRelationshipNamedType(modelClass) {
14 return get(modelClass, 'attributes').has('type') || get(modelClass, 'relationshipsByName').has('type');
15}
16
17export { modelHasAttributeOrRelationshipNamedType };