UNPKG

@backland/schema

Version:

TypeScript schema declaration and validation library with static type inference

29 lines (28 loc) 708 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BooleanField = void 0; var _utils = require("@backland/utils"); var _FieldType = require("./FieldType"); class BooleanField extends _FieldType.FieldType { constructor() { super({ def: undefined, name: 'boolean' }); this.parse = this.applyParser({ parse: input => { if (typeof input !== 'boolean') { throw new Error(`Expected boolean, found ${(0, _utils.getTypeName)(input)}`); } return input; } }); } static create = () => { return new BooleanField(); }; } exports.BooleanField = BooleanField; //# sourceMappingURL=BooleanField.js.map