-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
78 lines (58 loc) · 2.01 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import Joi from 'joi';
interface StringSchema extends Joi.StringSchema {
clean(): this;
/* replace &, >, <, ", ', \, / and ` with HTML entities. */
escape(): this;
/* replace &amp; | &gt; | &lt; | &quot; | &#36; | &#47; | &#92; | &#96; HTML entities with characters. */
unescape(): this;
/*
- sanitize string using function that takes a string as a parameter.
- returns sanitize string
*/
sanitize(sanitizer: (value: string) => string): this;
/* Requires the string value to only contain alphabetic characters. */
alpha(): this;
/* Requires the string value to only contain numeric characters. */
numeric(): this;
/* Requires the string value to be a valid decimal number. */
decimal(digit: number, decimal: number): this;
/* Requires the value to be a valid base32 string. */
base32(): this;
/* Requires the value to be a valid ISO alpha-2 or ISO alpha-3 country code. */
countryCode(type: 'alpha-2' | 'alpha-3'): this;
password(policy: {
/* password minimum length, default 8. */
min?: number;
/* password maximum length, default 24. */
max?: number;
/* if true, password requires lowercase. */
lowercase?: boolean;
/* if true, password requires uppercase. */
uppercase?: boolean;
/* if true, password requires number. */
number?: boolean;
/* if true, password requires special character. */
special?: boolean;
/*
- If defined, password is required to pass the number of requirements.
- If undefined, password is required to pass all of requirements.
*/
count?: number;
}): this;
/*
- Requires the string value to match the reference.
- Removed after validation.
*/
match(reference: string): this;
/*
- Requires the string value to contain the seed.
- If index is defined, position of the seed in the string must match the index.
- Set index to -1 to match from end of string.
*/
contain(seed: string, index?: number): this;
}
interface Root extends Joi.Root {
string(): StringSchema;
}
declare const root :Root;
export = root;