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) • 928 B
text/typescript
import { RequiredValidation } from '../../core.mjs';
import '../../commonTypes.mjs';
import '../../InferType.mjs';
import '../../helpers/constants.mjs';
/**
* @description Asserts that a bigint value does not exceed a specified maximum value.
* @param {bigint} expected The maximum allowable value.
* @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.
* @throws {ValidationError} if the received value exceeds the expected maximum value.
* @example
* const schema = bigint().custom(bigintMax(100n));
* parseOrFail(schema, 99n); // Valid
* parseOrFail(schema, 100n); // Valid
* parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than expected'
*
* @translation Error Translation Key = 'bi:max'
*/
declare const bigintMax: {
(expected: bigint): RequiredValidation;
key: string;
message: string;
};
export { bigintMax };