UNPKG

890 BJavaScriptView Raw
1"use strict";
2// Copyright IBM Corp. and LoopBack contributors 2017,2019. All Rights Reserved.
3// Node module: @loopback/repository
4// This file is licensed under the MIT License.
5// License text available at https://opensource.org/licenses/MIT
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.BooleanType = void 0;
8/* eslint-disable @typescript-eslint/no-explicit-any */
9/**
10 * Boolean type
11 */
12class BooleanType {
13 constructor() {
14 this.name = 'boolean';
15 }
16 isInstance(value) {
17 return value == null || typeof value === 'boolean';
18 }
19 defaultValue() {
20 return false;
21 }
22 isCoercible(value) {
23 return true;
24 }
25 coerce(value) {
26 return value == null ? value : Boolean(value);
27 }
28 serialize(value) {
29 return value;
30 }
31}
32exports.BooleanType = BooleanType;
33//# sourceMappingURL=boolean.js.map
\No newline at end of file