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.

26 lines (23 loc) 1.13 kB
import { RequiredValidation } from '../../core.js'; import '../../commonTypes.js'; import '../../InferType.js'; import '../../helpers/constants.js'; /** * @description - Asserts that a bigint value is strictly less than a specified maximum value (i.e., the maximum value is excluded). * @param {bigint} expected - The maximum allowable value, which is excluded. * @returns {RequiredValidation} - A validation function that takes a received bigint and an exception context. * @throws {ValidationError} if the received value is greater than or equal to the expected maximum value. * @example * const schema = bigint().custom(bigintMaxExcluded(100n)); * parseOrFail(schema, 99n); // Valid * parseOrFail(schema, 100n); // Throws an error: 'The received value is greater than or equal to expected' * parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than or equal to expected' * * @translation Error Translation Key = 'bi:maxExcluded' */ declare const bigintMaxExcluded: { (expected: bigint): RequiredValidation; key: string; message: string; }; export { bigintMaxExcluded };