nope-validator
Version:
Fast and simple JS validator
21 lines (20 loc) • 1.04 kB
TypeScript
import { NopePrimitive } from './NopePrimitive';
import { Nil } from './types';
export declare class NopeString extends NopePrimitive<string> {
protected _type: string;
validate(entry?: any, context?: Record<string, unknown>): string | undefined;
validateAsync(entry?: any, context?: Record<string, unknown>): Promise<string | undefined>;
protected isEmpty(value: string | Nil): boolean;
regex(regex: RegExp, message?: string): this;
url(message?: string): this;
email(message?: string): this;
min(length: number, message?: string): this;
max(length: number, message?: string): this;
greaterThan(length: number, message?: string): this;
lessThan(length: number, message?: string): this;
atLeast(length: number, message?: string): this;
atMost(length: number, message?: string): this;
between(startLength: number, endLength: number, atLeastMessage?: string, atMostMessage?: string): this;
exactLength(length: number, message?: string): this;
trim(): this;
}