UNPKG

jaywalk

Version:
37 lines 1.36 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var any_1 = require('./any'); var utils_1 = require('../utils'); var Boolean = (function (_super) { __extends(Boolean, _super); function Boolean(options) { if (options === void 0) { options = {}; } _super.call(this, options); this.type = 'Boolean'; this._tests.push(isBoolean); } Boolean.prototype._isType = function (value, path, context) { return utils_1.wrapIsType(this, value, path, context, _super.prototype._isType, function (value) { if (typeof value === 'boolean') { return 1; } throw context.error(path, 'Boolean', 'type', 'Boolean', value); }); }; Boolean.prototype._extend = function (options) { return _super.prototype._extend.call(this, options); }; return Boolean; }(any_1.Any)); exports.Boolean = Boolean; function isBoolean(value, path, context, next) { if (typeof value !== 'boolean') { throw context.error(path, 'Boolean', 'type', 'Boolean', value); } return next(value); } //# sourceMappingURL=boolean.js.map