export declare const emailRegex: RegExp; export declare const passwordRegex: RegExp; export declare const phoneRegex: RegExp; export declare const phoneRegexSk: RegExp; export declare const pscRegex: RegExp; export declare const rodneCisloRegex: RegExp; export declare abstract class Validator { readonly opts: OPTS; readonly msgs: MSGS; readonly str: string | null; readonly err: string | null; readonly obj: TYPE | null; constructor(opts?: OPTS, msgs?: MSGS); protected abstract strToObj(str?: string | null): { obj: TYPE | null; err: string; }; protected abstract objCheck(obj?: TYPE | null): string; protected abstract objToStr(obj?: TYPE | null, format?: string): { str: string; err: string; }; validate(value?: string | TYPE): { str?: string | null; obj?: TYPE | null; err: string; }; format(obj?: TYPE | null, format?: string): { str: string; err: string; }; } export declare function tpl(tmpl: string, data: { [k: string]: any; }): string; export interface ValidatorDataOpts { data?: { [key: string]: any; }; } export interface SelectValidatorOpts extends ValidatorDataOpts { required?: boolean; options?: string[]; } export interface SelectValidatorMsgs { required?: string; invalid_option?: string; } export declare class SelectValidator extends Validator { constructor(opts?: SelectValidatorOpts, msgs?: SelectValidatorMsgs); protected strToObj(str?: string | null): { obj: string | null; err: string; }; protected objCheck(obj?: string | null): string; protected objToStr(obj?: string | null, format?: string): { str: string; err: string; }; } export interface StringValidatorOpts extends ValidatorDataOpts { required?: boolean; min?: number; max?: number; regexp?: RegExp; } export interface StringValidatorMsgs { required?: string; invalid_format?: string; not_in_range?: string; } export declare class StringValidator extends Validator { constructor(opts?: StringValidatorOpts, msgs?: StringValidatorMsgs); protected strToObj(str?: string | null): { obj: string | null; err: string; }; protected objCheck(obj?: string | null): string; protected objToStr(obj?: string | null, format?: string): { str: string; err: string; }; } export interface NumberValidatorOpts extends ValidatorDataOpts { required?: boolean; min?: number; max?: number; strict?: boolean; decimals?: number; } export interface NumberValidatorMsgs { required?: string; invalid_format?: string; not_in_range?: string; } export declare class NumberValidator extends Validator { constructor(opts?: NumberValidatorOpts, msgs?: NumberValidatorMsgs); protected strToObj(str?: string | null): { obj: number | null; err: string; }; protected objCheck(obj?: number | null): string; protected objToStr(obj?: number | null, format?: string): { str: string; err: string; }; } export interface DateValidatorOpts extends ValidatorDataOpts { required?: boolean; min?: Date; max?: Date; dateOnly?: boolean; iso?: boolean; } export interface DateValidatorMsgs { required?: string; invalid_format?: string; not_in_range?: string; } export declare class DateValidator extends Validator { dateToStr: (date: Date) => string; constructor(opts?: DateValidatorOpts, msgs?: DateValidatorMsgs); protected strToObj(str?: string | null): { obj: Date | null; err: string; }; protected objCheck(obj?: Date | null): string; protected objToStr(obj?: Date | null, format?: string): { str: string; err: string; }; } export interface BooleanValidatorOpts extends ValidatorDataOpts { required?: boolean; value?: boolean; } export interface BooleanValidatorMsgs { required?: string; invalid_value?: string; } export declare class BooleanValidator extends Validator { constructor(opts?: BooleanValidatorOpts, msgs?: BooleanValidatorMsgs); protected strToObj(str?: string | null): { obj: boolean | null; err: string; }; protected objCheck(obj?: boolean | null): string; protected objToStr(obj?: boolean | null, format?: string): { str: string; err: string; }; } type FormValidators = { [key in keyof TYPE]: Validator; }; export type Str = { [key in keyof TYPE]: string; }; export type Obj = { [key in keyof TYPE]: any; }; export type Err = { [key in keyof TYPE]: string; }; export interface FormValidatorData { str: Str; obj: Obj; err: Err; valid: boolean; } export declare class FormValidator { readonly validators: FormValidators; readonly str?: Str; readonly obj?: Obj; readonly err?: Err; readonly valid?: boolean; addValidator(field: keyof TYPE, validator: Validator): this; validate(data: { [key in keyof TYPE]?: string; }): this; format(data: { [key in keyof TYPE]: any; }): this; data(): FormValidatorData; } export {};