UNPKG

bguard

Version:

**bguard** is a powerful, flexible, and type-safe validation library for TypeScript. It allows developers to define validation schemas for their data structures and ensures that data conforms to the expected types and constraints.

28 lines (19 loc) 1 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _chunkVBTWYDEMjs = require('./chunk-VBTWYDEM.js'); var _chunkTJQ5NVL4js = require('./chunk-TJQ5NVL4.js'); var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js'); // src/asserts/date/dateMax.ts var dateMaxErrorMessage = "The received value is greater than expected"; var dateMaxErrorKey = "dt:max"; var dateMax = (expected) => { const transformedExpected = typeof expected === "string" ? new Date(expected) : expected; if (!_chunkVBTWYDEMjs.isValidDateInner.call(void 0, transformedExpected)) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)("Invalid date in Date assertion"); return (received, ctx) => { if (transformedExpected < received) ctx.addIssue(transformedExpected, received, dateMaxErrorKey); }; }; dateMax.key = dateMaxErrorKey; dateMax.message = dateMaxErrorMessage; _chunkTJQ5NVL4js.setToDefaultLocale.call(void 0, dateMax); exports.dateMax = dateMax; //# sourceMappingURL=chunk-OQYS7JVF.js.map