@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
20 lines • 764 B
TypeScript
import { BaseValidator } from './base';
import isEmail from '../lib/isEmail';
import isURL from '../lib/isURL';
import type { StringValidatorType, ValidationNames } from '../types';
export declare function string(): StringValidator;
export declare class StringValidator extends BaseValidator<string> implements StringValidatorType {
name: ValidationNames;
constructor();
min(length: number): this;
max(length: number): this;
length(length: number): this;
email(options?: Parameters<typeof isEmail>[1]): this;
url(options?: Parameters<typeof isURL>[1]): this;
matches(pattern: RegExp): this;
equals(param: string): this;
alphanumeric(): this;
alpha(): this;
numeric(): this;
custom(fn: (value: string) => boolean, message: string): this;
}