MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / BooleanType

Class BooleanType

packages/repository/src/types/boolean.ts:13–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11 * Boolean type
12 */
13export class BooleanType implements Type<boolean> {
14 readonly name = 'boolean';
15
16 isInstance(value: any) {
17 return value == null || typeof value === 'boolean';
18 }
19
20 defaultValue() {
21 return false;
22 }
23
24 isCoercible(value: any): boolean {
25 return true;
26 }
27
28 coerce(value: any) {
29 return value == null ? value : Boolean(value);
30 }
31
32 serialize(value: boolean | null | undefined) {
33 return value;
34 }
35}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected