1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | declare namespace ValidatorJS {
|
15 | type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sk-SK" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA";
|
16 | type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG"| "cs-CZ" | "da-DK" | "de-DE" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sk-SK" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA";
|
17 | type DecimalLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA";
|
18 | type FloatLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "bg-BG" | "cs-CZ" | "da-DK" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "it-IT" | "nb-NO" | "nl-NL" | "nn-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "sv-SE" | "tr-TR" | "uk-UA";
|
19 | type MobilePhoneLocale = "ar-AE" | "ar-DZ" | "ar-EG" | "ar-JO" | "ar-SA" | "ar-SY" | "be-BY" | "bg-BG" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-KE" | "en-NG" | "en-NZ" | "en-UG" | "en-RW" | "en-SG" | "en-TZ" | "en-PK" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fa-IR" | "fi-FI" | "fo-FO" | "fr-FR" | "he-IL" | "hu-HU" | "id-ID" | "it-IT" | "ja-JP" | "kk-KZ" | "kl-GL" | "ko-KR" | "lt-LT" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sr-RS" | "th-TH" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW" | "any";
|
20 | type PostalCodeLocale = "AT" | "AU" | "BE" | "BG" | "CA" | "CH" | "CZ" | "DE" | "DK" | "DZ" | "ES" | "FI" | "FR" | "GB" | "GR" | "IL" | "IN" | "IS" | "IT" | "JP" | "KE" | "LI" | "MX" | "NL" | "NO" | "PL" | "PT" | "RO" | "RU" | "SA" | "SE" | "TW" | "US" | "ZA" | "ZM" | "any"
|
21 | type HashAlgorithm = "md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b";
|
22 |
|
23 | interface ValidatorStatic {
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | contains(str: string, elem: any): boolean;
|
31 |
|
32 |
|
33 | equals(str: string, comparison: string): boolean;
|
34 |
|
35 |
|
36 | isAfter(str: string, date?: string): boolean;
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | isAlpha(str: string, locale?: AlphaLocale): boolean;
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | isAlphanumeric(str: string, locale?: AlphanumericLocale): boolean;
|
51 |
|
52 |
|
53 | isAscii(str: string): boolean;
|
54 |
|
55 |
|
56 | isBase64(str: string): boolean;
|
57 |
|
58 |
|
59 | isBefore(str: string, date?: string): boolean;
|
60 |
|
61 |
|
62 | isBoolean(str: string): boolean;
|
63 |
|
64 |
|
65 | isByteLength(str: string, options: IsByteLengthOptions): boolean;
|
66 | isByteLength(str: string, min: number, max?: number): boolean;
|
67 |
|
68 |
|
69 | isCreditCard(str: string): boolean;
|
70 |
|
71 |
|
72 | isCurrency(str: string, options?: IsCurrencyOptions): boolean;
|
73 |
|
74 |
|
75 | isDataURI(str: string): boolean;
|
76 |
|
77 |
|
78 | isDecimal(str: string, options?: IsDecimalOptions): boolean;
|
79 |
|
80 |
|
81 | isDivisibleBy(str: string, number: number): boolean;
|
82 |
|
83 |
|
84 | isEmail(str: string, options?: IsEmailOptions): boolean;
|
85 |
|
86 |
|
87 | isEmpty(str: string, options?: IsEmptyOptions): boolean;
|
88 |
|
89 |
|
90 | isFQDN(str: string, options?: IsFQDNOptions): boolean;
|
91 |
|
92 |
|
93 | isFloat(str: string, options?: IsFloatOptions): boolean;
|
94 |
|
95 |
|
96 | isFullWidth(str: string): boolean;
|
97 |
|
98 |
|
99 | isHalfWidth(str: string): boolean;
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | isHash(str: string, algorithm: HashAlgorithm): boolean;
|
105 |
|
106 |
|
107 | isHexColor(str: string): boolean;
|
108 |
|
109 |
|
110 | isHexadecimal(str: string): boolean;
|
111 |
|
112 |
|
113 | isIP(str: string, version?: number): boolean;
|
114 |
|
115 |
|
116 | isISBN(str: string, version?: number): boolean;
|
117 |
|
118 |
|
119 | isISSN(str: string, options?: IsISSNOptions): boolean;
|
120 |
|
121 |
|
122 |
|
123 | isISIN(str: string): boolean;
|
124 |
|
125 |
|
126 | isISO8601(str: string, options?: IsISO8601Options): boolean;
|
127 |
|
128 |
|
129 |
|
130 | isISO31661Alpha2(str: string): boolean;
|
131 |
|
132 |
|
133 |
|
134 | isISO31661Alpha3(str: string): boolean;
|
135 |
|
136 |
|
137 | isISRC(str: string): boolean;
|
138 |
|
139 |
|
140 | isIn(str: string, values: any[]): boolean;
|
141 |
|
142 |
|
143 | isInt(str: string, options?: IsIntOptions): boolean;
|
144 |
|
145 |
|
146 | isJSON(str: string): boolean;
|
147 |
|
148 |
|
149 | isJWT(str: string): boolean;
|
150 |
|
151 |
|
152 | isLatLong(str: string): boolean;
|
153 |
|
154 |
|
155 |
|
156 | isLength(str: string, options: IsLengthOptions): boolean;
|
157 | isLength(str: string, min: number, max?: number): boolean;
|
158 |
|
159 |
|
160 | isLowercase(str: string): boolean;
|
161 |
|
162 |
|
163 | isMACAddress(str: string): boolean;
|
164 |
|
165 |
|
166 | isMD5(str: string): boolean;
|
167 |
|
168 |
|
169 | isMimeType(str: string): boolean;
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | isMobilePhone(str: string, locale: MobilePhoneLocale, options?: IsMobilePhoneOptions): boolean;
|
179 |
|
180 |
|
181 |
|
182 | isMongoId(str: string): boolean;
|
183 |
|
184 |
|
185 | isMultibyte(str: string): boolean;
|
186 |
|
187 |
|
188 | isNumeric(str: string, options?: IsNumericOptions): boolean;
|
189 |
|
190 |
|
191 | isPort(str: string): boolean;
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 | isPostalCode(str: string, locale: PostalCodeLocale): boolean;
|
199 |
|
200 |
|
201 | isSurrogatePair(str: string): boolean;
|
202 |
|
203 |
|
204 | isURL(str: string, options?: IsURLOptions): boolean;
|
205 |
|
206 |
|
207 | isUUID(str: string, version?: 3|4|5|"3"|"4"|"5"|"all"): boolean;
|
208 |
|
209 |
|
210 | isUppercase(str: string): boolean;
|
211 |
|
212 |
|
213 | isVariableWidth(str: string): boolean;
|
214 |
|
215 |
|
216 | isWhitelisted(str: string, chars: string | string[]): boolean;
|
217 |
|
218 |
|
219 | matches(str: string, pattern: RegExp | string, modifiers?: string): boolean;
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | blacklist(input: string, chars: string): string;
|
228 |
|
229 |
|
230 | escape(input: string): string;
|
231 |
|
232 |
|
233 | unescape(input: string): string;
|
234 |
|
235 |
|
236 | ltrim(input: string, chars?: string): string;
|
237 |
|
238 |
|
239 | normalizeEmail(email: string, options?: NormalizeEmailOptions): string | false;
|
240 |
|
241 |
|
242 | rtrim(input: string, chars?: string): string;
|
243 |
|
244 |
|
245 |
|
246 | stripLow(input: string, keep_new_lines?: boolean): string;
|
247 |
|
248 |
|
249 |
|
250 | toBoolean(input: string, strict?: boolean): boolean;
|
251 |
|
252 |
|
253 | toDate(input: string): Date;
|
254 |
|
255 |
|
256 | toFloat(input: string): number;
|
257 |
|
258 |
|
259 | toInt(input: string, radix?: number): number;
|
260 |
|
261 |
|
262 | trim(input: string, chars?: string): string;
|
263 |
|
264 |
|
265 |
|
266 | whitelist(input: string, chars: string): string;
|
267 |
|
268 | toString(input: any | any[]): string;
|
269 |
|
270 | version: string;
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 | extend<T extends Function>(name: string, fn: T): void;
|
279 | }
|
280 |
|
281 |
|
282 | interface IsByteLengthOptions {
|
283 | min?: number;
|
284 | max?: number;
|
285 | }
|
286 |
|
287 |
|
288 | interface IsCurrencyOptions {
|
289 | symbol?: string;
|
290 | require_symbol?: boolean;
|
291 | allow_space_after_symbol?: boolean;
|
292 | symbol_after_digits?: boolean;
|
293 | allow_negatives?: boolean;
|
294 | parens_for_negatives?: boolean;
|
295 | negative_sign_before_digits?: boolean;
|
296 | negative_sign_after_digits?: boolean;
|
297 | allow_negative_sign_placeholder?: boolean;
|
298 | thousands_separator?: string;
|
299 | decimal_separator?: string;
|
300 | allow_decimal?: boolean;
|
301 | require_decimal?: boolean;
|
302 | digits_after_decimal?: number[];
|
303 | allow_space_after_digits?: boolean;
|
304 | }
|
305 |
|
306 |
|
307 | interface IsDecimalOptions {
|
308 | force_decimal?: boolean;
|
309 | decimal_digits?: string;
|
310 | locale?: DecimalLocale;
|
311 | }
|
312 |
|
313 |
|
314 | interface IsEmailOptions {
|
315 | allow_display_name?: boolean;
|
316 | require_display_name?: boolean;
|
317 | allow_utf8_local_part?: boolean;
|
318 | require_tld?: boolean;
|
319 | }
|
320 |
|
321 |
|
322 | interface IsEmptyOptions {
|
323 | ignore_whitespace?: boolean;
|
324 | }
|
325 |
|
326 |
|
327 | interface IsFQDNOptions {
|
328 | require_tld?: boolean;
|
329 | allow_underscores?: boolean;
|
330 | allow_trailing_dot?: boolean;
|
331 | }
|
332 |
|
333 |
|
334 | interface IsFloatOptions {
|
335 | min?: number;
|
336 | max?: number;
|
337 | gt?: number;
|
338 | lt?: number;
|
339 | locale?: FloatLocale;
|
340 | }
|
341 |
|
342 |
|
343 | interface IsISSNOptions {
|
344 | case_sensitive?: boolean;
|
345 | require_hyphen?: boolean;
|
346 | }
|
347 |
|
348 |
|
349 | interface IsIntOptions {
|
350 | min?: number;
|
351 | max?: number;
|
352 | allow_leading_zeroes?: boolean;
|
353 | lt?: number;
|
354 | gt?: number;
|
355 | }
|
356 |
|
357 |
|
358 | interface IsISO8601Options {
|
359 | strict?: boolean;
|
360 | }
|
361 |
|
362 |
|
363 | interface IsLengthOptions {
|
364 | min?: number;
|
365 | max?: number;
|
366 | }
|
367 |
|
368 |
|
369 | interface IsMobilePhoneOptions {
|
370 | strictMode?: boolean;
|
371 | }
|
372 |
|
373 |
|
374 | interface IsURLOptions {
|
375 | protocols?: string[];
|
376 | require_tld?: boolean;
|
377 | require_protocol?: boolean;
|
378 | require_host?: boolean;
|
379 | require_valid_protocol?: boolean;
|
380 | allow_underscores?: boolean;
|
381 | host_whitelist?: (string | RegExp)[];
|
382 | host_blacklist?: (string | RegExp)[];
|
383 | allow_trailing_dot?: boolean;
|
384 | allow_protocol_relative_urls?: boolean;
|
385 | disallow_auth?: boolean;
|
386 | }
|
387 |
|
388 |
|
389 | interface NormalizeEmailOptions {
|
390 | all_lowercase?: boolean;
|
391 | gmail_lowercase?: boolean;
|
392 | gmail_remove_dots?: boolean;
|
393 | gmail_remove_subaddress?: boolean;
|
394 | gmail_convert_googlemaildotcom?: boolean;
|
395 | outlookdotcom_lowercase?: boolean;
|
396 | outlookdotcom_remove_subaddress?: boolean;
|
397 | yahoo_lowercase?: boolean;
|
398 | yahoo_remove_subaddress?: boolean;
|
399 | icloud_lowercase?: boolean;
|
400 | icloud_remove_subaddress?: boolean;
|
401 | }
|
402 |
|
403 | |
404 |
|
405 |
|
406 | interface IsNumericOptions {
|
407 | no_symbols?: boolean;
|
408 | }
|
409 | }
|
410 |
|
411 |
|
412 |
|
413 |
|
414 | declare var validator: ValidatorJS.ValidatorStatic;
|
415 |
|
416 | declare module "validator" {
|
417 | export = validator;
|
418 | }
|
419 |
|
420 |
|
421 | interface IValidatorStatic extends ValidatorJS.ValidatorStatic { }
|
422 | interface IURLoptions extends ValidatorJS.IsURLOptions { }
|
423 | interface IFQDNoptions extends ValidatorJS.IsFQDNOptions { }
|
424 | interface IEmailoptions extends ValidatorJS.NormalizeEmailOptions { }
|