ts-cast
Version:
Runtime typechecking
14 lines (13 loc) • 677 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.undef = void 0;
var engine_1 = require("../engine");
var throw_type_error_1 = require("../engine/throw-type-error");
var castUndefined = function (value, context, reportError) {
if (reportError === void 0) { reportError = throw_type_error_1.throwTypeError; }
if (value === undefined)
return undefined;
return reportError("undefined is expected".concat(context ? " in ".concat(context) : '', " but \"").concat(value, "\" received."), context);
};
Object.defineProperty(castUndefined, 'name', { value: 'undefined' });
exports.undef = (0, engine_1.casterApi)(castUndefined);