@mub22/validity
Version:
Lightweight JavaScript validation library inspired by Laravel's rule syntax. Validate fields and forms easily with built-in rules and error messages.
15 lines (14 loc) • 443 B
TypeScript
export type RuleFn = (value: any, arg?: string, data?: Record<string, any>) => boolean;
export type RuleFnWithData = (value: any, arg?: string, data?: Record<string, any>) => {
isValidFnWithData: boolean;
args?: Record<string, string>;
};
export interface ValidationResult {
valid: boolean;
errors: string[];
}
export interface FormValidationResult {
valid: boolean;
errors: Record<string, string[]>;
logs?: any;
}