ez-validation
Version:
Validation made Ez
27 lines (26 loc) • 1.27 kB
TypeScript
export declare class EZValidationAPI {
validating: any;
errorMessage?: string | undefined;
errorMessages: string[];
hasError: boolean;
constructor(validating: any, errorMessage?: string | undefined, errorMessages?: string[]);
_returnError(errorMessage: string): void;
required(errorMessage?: string): this;
isString(errorMessage?: string): this;
isNumber(errorMessage?: string): this;
isWholeNumber(errorMessage?: string): this;
isBoolean(errorMessage?: string): this;
isEmpty(errorMessage?: string): this;
isObject(errorMessage?: string): this;
isAlphanumeric(errorMessage?: string): this;
isEmail(errorMessage?: string): this;
isPhoneNumber(errorMessage?: string): this;
isUSAZipCode(errorMessage?: string): this;
maxLength(max: number, errorMessage?: string): this;
minLength(min: number, errorMessage?: string): this;
maxValue(max: number, errorMessage?: string): this;
minValue(min: number, errorMessage?: string): this;
customRegex(regex: any, errorMessage?: string): this;
customValidation(cb: (validating: any) => boolean | string, errorMessage?: string): this;
}
export declare const EzValidation: (val: any, defaultErrorMessage?: string | undefined) => EZValidationAPI;