MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / coerce

Method coerce

packages/repository/src/types/array.ts:40–47  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

38 }
39
40 coerce(value: any) {
41 if (value == null) return value;
42 if (!Array.isArray(value)) {
43 const msg = util.format('Invalid %s: %j', this.name, value);
44 throw new TypeError(msg);
45 }
46 return value.map(i => this.itemType.coerce(i));
47 }
48
49 serialize(value: T[] | null | undefined) {
50 if (value == null) return value;

Callers

nothing calls this directly

Calls 1

coerceMethod · 0.65

Tested by

no test coverage detected