UNPKG

sure-guard

Version:
50 lines (49 loc) 1.45 kB
/** * Class for validating numbers. */ export declare class NumberValidator { private readonly value; private isValid; /** * Creates a new NumberValidator instance. * @param {any} value - The value to be validated. */ constructor(value: any); /** * Checks if the value is of type number. * @returns {this} - The NumberValidator instance. */ isNumber(): this; /** * Checks if the value is greater than or equal to a minimum. * @param {number} minValue - The minimum value allowed. * @returns {this} - The NumberValidator instance. */ isMinValue(minValue: number): this; /** * Checks if the value is less than or equal to a maximum. * @param {number} maxValue - The maximum value allowed. * @returns {this} - The NumberValidator instance. */ isMaxValue(maxValue: number): this; /** * Checks if the value is positive. * @returns {this} - The NumberValidator instance. */ isPositive(): this; /** * Checks if the value is negative. * @returns {this} - The NumberValidator instance. */ isNegative(): this; /** * Checks if the value is an integer number. * @returns {this} - The NumberValidator instance. */ isInteger(): this; /** * Returns the result of the validation. * @returns {boolean} - The result of the validation. */ getResult(): boolean; }