js-formdata-validator
Version:
JS Form Validator is a simple form data validation library for JavaScript. It provides a set of base rules for checking the type and value of various inputs, and allows you to define custom rules as well.
14 lines (13 loc) • 427 B
TypeScript
import type { ErrorBag } from "./type";
export default class ValidatorError {
private errorMessage;
private errorBag;
add(field: string, error: string): void;
clearErrorBag(): void;
getErrorBag(): ErrorBag;
setFieldErrors(field: string, errors: string[]): void;
setErrorMessage(errorMessage: string): void;
getErrorMessage(): string;
private defaultErrorMessage;
hasErrors(): boolean;
}