UNPKG

ts-valid8

Version:

A next-generation TypeScript validation library with advanced features

64 lines 2.25 kB
import { BaseSchema } from '../core/schema'; import { ValidationContext, ValidationResult } from '../core/types'; /** * NumberSchema - Advanced number validation with unique features */ export declare class NumberSchema extends BaseSchema<number> { _type: string; protected validateType(value: unknown, context: ValidationContext): ValidationResult<number>; protected clone(): NumberSchema; /** * Require the number to be less than a maximum value */ max(max: number, message?: string): NumberSchema; /** * Require the number to be greater than a minimum value */ min(min: number, message?: string): NumberSchema; /** * Require the number to be an integer */ integer(message?: string): NumberSchema; /** * Require the number to be positive (> 0) */ positive(message?: string): NumberSchema; /** * Require the number to be negative (< 0) */ negative(message?: string): NumberSchema; /** * Require the number to be divisible by a given value * Unique feature not commonly found in other libraries */ divisibleBy(divisor: number, message?: string): NumberSchema; /** * Require the number to be within a certain range */ range(min: number, max: number, message?: string): NumberSchema; /** * Require the number to be a multiple of step * Useful for validating increments (like currency steps of 0.01) */ step(step: number, message?: string): NumberSchema; /** * Safe integer validation - values that can be safely represented in JavaScript * Unique validation not commonly found in other libraries */ safeInteger(message?: string): NumberSchema; /** * Finite number validation - not Infinity or -Infinity */ finite(message?: string): NumberSchema; /** * Port number validation * Unique validator for network applications */ port(message?: string): NumberSchema; /** * Precision validation - check if number has at most the specified decimal places * Unique feature compared to other libraries */ precision(maxDecimalPlaces: number, message?: string): NumberSchema; } //# sourceMappingURL=number.d.ts.map