UNPKG

@korbiniankuhn/validator

Version:

Validate object schemas for js, expressjs, angular and mongoose.

32 lines (31 loc) 1.43 kB
import { ValidatorOptions } from '../../interfaces/validator-options.interface'; import { AnySchema } from './types/any'; import { Message } from '../../utils/message'; import { BooleanSchema } from './types/boolean'; import { StringSchema } from './types/string'; import { NumberSchema } from './types/number'; import { DateSchema } from './types/date'; import { ArraySchema } from './types/array'; import { ObjectSchema } from './types/object'; import { Locale } from './../../interfaces/locale.interface'; export declare class Validator { _options: ValidatorOptions; _customs: any; _types: any[]; _message: Message; constructor(options?: ValidatorOptions); validate(schema: AnySchema, data: any): Promise<any>; validateSync(schema: AnySchema, data: any): any; addLocale(name: string, messages: Locale): this; setLocale(name: string): this; addType(name: string, schema: AnySchema): this; Custom(name: string): any; listCustomTypes(): string[]; Any(options?: ValidatorOptions): AnySchema; Array(schema?: AnySchema, options?: ValidatorOptions): ArraySchema; Boolean(options?: ValidatorOptions): BooleanSchema; Date(options?: ValidatorOptions): DateSchema; Number(options?: ValidatorOptions): NumberSchema; Object(schema?: object, options?: ValidatorOptions): ObjectSchema; String(options?: ValidatorOptions): StringSchema; }