UNPKG

nope-validator

Version:
21 lines (20 loc) 1.08 kB
import { Rule, Validatable } from './types'; import { NopeObject } from './NopeObject'; export declare class NopeArray<T> implements Validatable<T[]> { protected _type: string; validationRules: Rule<T[]>[]; ofShape: Validatable<T> | NopeObject | null; getType(): string; required(message?: string): this; of(primitive: Validatable<T> | NopeObject, message?: string): this; ofAsync(primitive: Validatable<T> | NopeObject, message?: string): this; minLength(length: number, message?: string): this; maxLength(length: number, message?: string): this; mustContain(value: T, message?: string): this; hasOnly(values: T[], message?: string): this; every(callback: (value: T) => boolean, message?: string): this; some(callback: (value: T) => boolean, message?: string): this; test(rule: Rule<T[]>): this; validate(entry?: T[] | null, context?: Record<string | number, unknown>): string | undefined; validateAsync(entry?: T[] | null, context?: Record<string | number, unknown>): Promise<string | undefined>; }