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

Function validateParams

packages/core/src/entity/validators.ts:50–62  ·  view source on GitHub ↗
(params: any, type = 'search condition', field?: string)

Source from the content-addressed store, hash-verified

48
49/** @internal */
50export function validateParams(params: any, type = 'search condition', field?: string): void {
51 if (Utils.isPrimaryKey(params) || Utils.isEntity(params)) {
52 return;
53 }
54
55 if (Array.isArray(params)) {
56 return params.forEach(item => validateParams(item, type, field));
57 }
58
59 if (Utils.isPlainObject(params)) {
60 Object.keys(params).forEach(k => validateParams(params[k], type, k));
61 }
62}
63
64/** @internal */
65export function validatePrimaryKey<T>(entity: EntityData<T>, meta: EntityMetadata<T>): void {

Callers 10

findMethod · 0.85
streamMethod · 0.85
findOneMethod · 0.85
upsertMethod · 0.85
upsertManyMethod · 0.85
insertMethod · 0.85
insertManyMethod · 0.85
nativeUpdateMethod · 0.85
nativeDeleteMethod · 0.85
countMethod · 0.85

Calls 4

isPrimaryKeyMethod · 0.80
isPlainObjectMethod · 0.80
isEntityMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected