UNPKG

1.03 kBTypeScriptView Raw
1// tslint:disable-next-line:no-implicit-dependencies
2import * as val from 'validator';
3
4type OrigValidator = typeof val;
5
6export interface Extensions {
7 notEmpty(str: string): boolean;
8 len(str: string, min: number, max: number): boolean;
9 isUrl(str: string): boolean;
10 isIPv6(str: string): boolean;
11 isIPv4(str: string): boolean;
12 notIn(str: string, values: string[]): boolean;
13 regex(str: string, pattern: string, modifiers: string): boolean;
14 notRegex(str: string, pattern: string, modifiers: string): boolean;
15 min(str: string, val: number): boolean;
16 max(str: string, val: number): boolean;
17 not(str: string, pattern: string, modifiers: string): boolean;
18 contains(str: string, elem: string[]): boolean;
19 notContains(str: string, elem: string[]): boolean;
20 is(str: string, pattern: string, modifiers: string): boolean;
21}
22export const extensions: Extensions;
23
24export interface Validator extends OrigValidator, Extensions {
25 contains(str: string, elem: string[]): boolean;
26}
27export const validator: Validator;