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

Method coerce

packages/repository/src/types/string.ts:28–37  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

26 }
27
28 coerce(value: any): string {
29 if (value == null) return value;
30 if (typeof value.toJSON === 'function') {
31 value = value.toJSON();
32 }
33 if (typeof value === 'object') {
34 return JSON.stringify(value);
35 }
36 return String(value);
37 }
38
39 serialize(value: string | null | undefined) {
40 return value;

Callers

nothing calls this directly

Calls 1

toJSONMethod · 0.45

Tested by

no test coverage detected