MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / isEntity

Method isEntity

packages/core/src/utils/Utils.ts:682–692  ·  view source on GitHub ↗

* Checks whether given object is an entity instance.

(data: any, allowReference = false)

Source from the content-addressed store, hash-verified

680 * Checks whether given object is an entity instance.
681 */
682 static isEntity<T = unknown>(data: any, allowReference = false): data is T & {} {
683 if (!Utils.isObject(data)) {
684 return false;
685 }
686
687 if (allowReference && Reference.isReference(data)) {
688 return true;
689 }
690
691 return EntityHelper.isEntity(data);
692 }
693
694 /**
695 * Checks whether given object is a scalar reference.

Callers 15

propagatePopulateHintMethod · 0.45
initMethod · 0.45
findOneOrFailMethod · 0.45
upsertMethod · 0.45
upsertManyMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
insertManyMethod · 0.45
mergeMethod · 0.45
persistMethod · 0.45
removeMethod · 0.45
propagateMethod · 0.45

Calls 2

isObjectMethod · 0.80
isReferenceMethod · 0.80

Tested by

no test coverage detected