-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
181 lines (151 loc) · 4.4 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/**
* @author zurmokeeper
* github home page https://github.com/zurmokeeper/miniJoi
*/
export = miniJoi;
declare namespace miniJoi{
interface Options {
/**
* Whether to output joi error messages.
*
* optional
* @default false
*/
clear?: boolean;
/**
* Custom error object.
*
* optional
*/
error?: Error;
/**
* Custom regular expression.
*
* optional
*/
pattern?: RegExp;
/**
* Phone number mode.
*
* optional
*/
mode?: 'strict' | 'loose';
/**
* ip version.
*
* optional
*/
version?: 'ipv4' | 'ipv6';
/**
* ID version.
*
* optional
*/
generation?: 'first' | 'second';
}
type OpTypes =
| 'gt'
| 'gte'
| 'lt'
| 'lte'
| 'left-close-right-close'
| 'left-close-right-open'
| 'left-open-right-open'
| 'left-open-right-close'
| 'l-c-r-c'
| 'l-c-r-o'
| 'l-o-r-o'
| 'l-o-r-c';
/**
* @description 字符串必填且非空
*/
function requireAndNotEmptyForStr(value: string, options?: Options): boolean;
/**
* @description 字符串必填可以为空
*/
function requireAndIsEmptyForStr(value: string, options?: Options): boolean;
/**
* @description 必填字符串枚举
*/
function requireAndEnumForStr(value: string, enumArr:string[] , options?: Options): boolean;
/**
* @description 必填字符串特定长度
*/
function length(value: string, limit:number , options?: Options): boolean;
/**
* @description 必填字符串最大长度
*/
function max(value: string, options?: Options): boolean;
/**
* @description 必填字符串最小长度
*/
function min(value: string, options?: Options): boolean;
/**
* @description 必填字符串中文姓名
*/
function name(value: string, options?: Options): boolean;
/**
* @description 必填字符串且合法邮箱
*/
function requireEmail(value: string, options?: Options): boolean;
/**
* @description 必填字符串且合法电话号码
*/
function requirePhone(value: string, options?: Options): boolean;
/**
* @description 必填字符串且合法IP
*/
function requireIP(value: string, options?: Options): boolean;
/**
* @description 必填字符串且合法Url
*/
function requireUrl(value: string, limit:number , options?: Options): boolean;
/**
* @description 必填字符串且合法身份证
*/
function requireID(value: string, limit:number , options?: Options): boolean;
/**
* @description 必填数字
*/
function requireForNum(value: number, options?: Options): boolean;
/**
* @description 整数
*/
function requireForInt(value: number, options?: Options): boolean;
/**
* @description 必填数字枚举
*/
function requireAndEnumForNum(value: number, enumArr : number[] , options?: Options): boolean;
/**
* @description 必填数字范围
*/
function requireForRangeNum(value: number, op : OpTypes, limit:number | number[], options?: Options): boolean;
/**
* @description 必填整数范围
*/
function requireForRangeInt(value: number, op : OpTypes, limit:number | number[], options?: Options): boolean;
/**
* @description 必填数字小数位不大于 limit 位
*/
function requireAndPrecision(value: number, limit : number , options?: Options): boolean;
/**
* @description 数组必填可以为空
*/
function requireAndIsEmptyForArr(value: array, options?: Options): boolean;
/**
* @description 数组必填且非空
*/
function requireAndNotEmptyForArr(value: array, options?: Options): boolean;
/**
* @description 对象必填可以为空
*/
function requireAndIsEmptyForObj(value: Options, options?: Options): boolean;
/**
* @description 对象必填且非空
*/
function requireAndNotEmptyForObj(value: Options, options?: Options): boolean;
/**
* @description 必填布尔
*/
function requireForBool(value: boolean, options?: Options): boolean;
}