validator (v9.4): add options for isMobilePhone()

This commit is contained in:
Naoto Yokoyama
2018-02-20 22:56:58 +09:00
parent d29b1a2fe1
commit f8af9626d7
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for validator.js v9.3
// Type definitions for validator.js v9.4
// Project: https://github.com/chriso/validator.js
// Definitions by: tgfjt <https://github.com/tgfjt>
// Ilya Mochalov <https://github.com/chrootsu>
@@ -163,7 +163,7 @@ declare namespace ValidatorJS {
// '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']).
isMobilePhone(str: string, locale: MobilePhoneLocale): boolean;
isMobilePhone(str: string, locale: MobilePhoneLocale, options?: IsMobilePhoneOptions): boolean;
// check if the string is a valid hex-encoded representation of a MongoDB ObjectId
// (http://docs.mongodb.org/manual/reference/object-id/).
@@ -337,6 +337,11 @@ declare namespace ValidatorJS {
max?: number;
}
// options for isMobilePhone
interface IsMobilePhoneOptions {
strictMode?: boolean;
}
// options for isURL
interface IsURLOptions {
protocols?: string[];
+2
View File
@@ -491,6 +491,8 @@ let any: any;
result = validator.isMimeType('sample');
let isMobilePhoneOptions: ValidatorJS.IsMobilePhoneOptions;
result = validator.isMobilePhone('sample', 'any', isMobilePhoneOptions);
result = validator.isMobilePhone('sample', 'ar-AE');
result = validator.isMobilePhone('sample', 'ar-DZ');
result = validator.isMobilePhone('sample', 'ar-EG');