1 |
|
2 | import * as val from 'validator';
|
3 |
|
4 | type OrigValidator = typeof val;
|
5 |
|
6 | export 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 | }
|
22 | export const extensions: Extensions;
|
23 |
|
24 | export interface Validator extends OrigValidator, Extensions {
|
25 | contains(str: string, elem: string[]): boolean;
|
26 | }
|
27 | export const validator: Validator;
|