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.09 kB
TypeScript
import { RequiredValidation } from '../../core.js';
import '../../commonTypes.js';
import '../../InferType.js';
import '../../helpers/constants.js';
/**
* @description Asserts that a number value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).
* @param {number} expected The minimum allowable value, which is excluded.
* @returns {RequiredValidation} A validation function that takes a received number and an exception context.
* @throws {ValidationError} if the received value is less than or equal to the expected minimum value.
* @example
* const schema = number().custom(minExcluded(10));
* parseOrFail(schema, 11); // Valid
* parseOrFail(schema, 10); // Throws an error: 'The received value is less than or equal to expected'
* parseOrFail(schema, 9); // Throws an error: 'The received value is less than or equal to expected'
*
* @translation Error Translation Key = 'n:minExcluded'
*/
declare const minExcluded: {
(expected: number): RequiredValidation;
key: string;
message: string;
};
export { minExcluded };