From 0a8ccb501efcee421cc8acfe02c3ee13eca28b1c Mon Sep 17 00:00:00 2001 From: bglee Date: Tue, 1 Aug 2017 19:47:10 +0900 Subject: [PATCH 1/2] update validator --- types/validator/index.d.ts | 6 +++--- types/validator/validator-tests.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 74bf331ed6..d0749b48bb 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -6,7 +6,7 @@ declare namespace ValidatorJS { 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" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; 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" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" + type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" interface ValidatorStatic { @@ -132,7 +132,7 @@ declare namespace ValidatorJS { // check if the string is a mobile phone number, (locale is one of // ['ar-DZ', 'ar-SA', 'ar-SY', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', // 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'hu-HU', - // 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', + // 'it-IT', 'ja-JP', 'ko-KR', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', // 'vi-VN', 'zh-CN', 'zh-TW']). isMobilePhone(str: string, locale: MobilePhoneLocale): boolean; @@ -218,7 +218,7 @@ declare namespace ValidatorJS { whitelist(input: string, chars: string): string; toString(input: any | any[]): string; - + version: string; // ************** diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 48621f1acd..2cd3657b74 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -451,6 +451,7 @@ let any: any; result = validator.isMobilePhone('sample', 'hu-HU'); result = validator.isMobilePhone('sample', 'it-IT'); result = validator.isMobilePhone('sample', 'ja-JP'); + result = validator.isMobilePhone('sample', 'ko-KR'); result = validator.isMobilePhone('sample', 'ms-MY'); result = validator.isMobilePhone('sample', 'nb-NO'); result = validator.isMobilePhone('sample', 'nn-NO'); From 28d1c5dfdf4589a36e779c86ffb660007d8e9bdf Mon Sep 17 00:00:00 2001 From: bglee Date: Tue, 1 Aug 2017 19:52:31 +0900 Subject: [PATCH 2/2] add ko-KR to MobilePhoneLocale --- types/validator/index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 685ad12d63..ed0aa87a88 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -1,12 +1,17 @@ // Type definitions for validator.js v6.2 // Project: https://github.com/chriso/validator.js -// Definitions by: tgfjt , Ilya Mochalov , Ayman Nedjmeddine , Louy Alakkad , Kacper Polak +// Definitions by: tgfjt +// Ilya Mochalov +// Ayman Nedjmeddine +// Louy Alakkad +// Kacper Polak +// Bonggyun Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ValidatorJS { 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" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; 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" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" | "any"; + type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" | "any"; interface ValidatorStatic {