@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
15 lines • 585 B
TypeScript
import { NumberValidator } from './numbers';
import type { DecimalValidatorType, ValidationNames } from '../types';
// Export a function to create decimal validators
export declare function decimal(): DecimalValidator;
export declare class DecimalValidator extends NumberValidator implements DecimalValidatorType {
name: ValidationNames;
constructor();
min(min: number): this;
max(max: number): this;
length(length: number): this;
positive(): this;
negative(): this;
divisibleBy(divisor: number): this;
custom(fn: (value: number) => boolean, message: string): this;
}