mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
validator (v9.1): add isISO31661Alpha2() and some locales
Added locales are: - fo-FO, kl-GL (https://github.com/chriso/validator.js/pull/735)
This commit is contained in:
Vendored
+15
-6
@@ -1,4 +1,4 @@
|
||||
// Type definitions for validator.js v9.0
|
||||
// Type definitions for validator.js v9.1
|
||||
// Project: https://github.com/chriso/validator.js
|
||||
// Definitions by: tgfjt <https://github.com/tgfjt>
|
||||
// Ilya Mochalov <https://github.com/chrootsu>
|
||||
@@ -14,7 +14,7 @@ declare namespace ValidatorJS {
|
||||
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" | "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";
|
||||
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" | "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";
|
||||
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" | "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";
|
||||
type MobilePhoneLocale = "ar-AE" | "ar-DZ" | "ar-EG" | "ar-JO" | "ar-SA" | "ar-SY" | "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-TZ" | "en-PK" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fa-IR" | "fi-FI" | "fr-FR" | "he-IL" | "hu-HU" | "id-ID" | "it-IT" | "ja-JP" | "ko-KR" | "lt-LT" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sr-RS" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW" | "any";
|
||||
type MobilePhoneLocale = "ar-AE" | "ar-DZ" | "ar-EG" | "ar-JO" | "ar-SA" | "ar-SY" | "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-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" | "kl-GL" | "ko-KR" | "lt-LT" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sr-RS" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW" | "any";
|
||||
type PostalCodeLocale = "AT" | "AU" | "BE" | "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"
|
||||
type HashAlgorithm = "md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b";
|
||||
|
||||
@@ -120,6 +120,10 @@ declare namespace ValidatorJS {
|
||||
// check if the string is a valid ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601) date.
|
||||
isISO8601(str: string): boolean;
|
||||
|
||||
// check if the string is a valid ISO 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned
|
||||
// country code.
|
||||
isISO31661Alpha2(str: string): boolean;
|
||||
|
||||
// check if the string is a ISRC (https://en.wikipedia.org/wiki/International_Standard_Recording_Code).
|
||||
isISRC(str: string): boolean;
|
||||
|
||||
@@ -152,10 +156,10 @@ declare namespace ValidatorJS {
|
||||
// check if the string is a mobile phone number, (locale is one of
|
||||
// ['ar-AE', ar-DZ', 'ar-EG', 'ar-JO', 'ar-SA', 'ar-SY', '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-TZ',
|
||||
// 'en-PK', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL',
|
||||
// 'hu-HU', 'id-ID', 'it-IT', 'ja-JP', 'ko-KR', lt-LT', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL',
|
||||
// 'pt-PT', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK',
|
||||
// 'zh-TW']).
|
||||
// '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', 'kl-GL', 'ko-KR', lt-LT', 'ms-MY', 'nb-NO',
|
||||
// 'nn-NO', 'pl-PL', 'pt-PT', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'tr-TR', 'uk-UA', 'vi-VN',
|
||||
// 'zh-CN', 'zh-HK', 'zh-TW']).
|
||||
isMobilePhone(str: string, locale: MobilePhoneLocale): boolean;
|
||||
|
||||
// check if the string is a valid hex-encoded representation of a MongoDB ObjectId
|
||||
@@ -511,6 +515,11 @@ declare module "validator/lib/isISO8601" {
|
||||
export = isISO8601;
|
||||
}
|
||||
|
||||
declare module "validator/lib/isISO31661Alpha2" {
|
||||
const isISO31661Alpha2: typeof validator.isISO31661Alpha2;
|
||||
export = isISO31661Alpha2;
|
||||
}
|
||||
|
||||
declare module "validator/lib/isISRC" {
|
||||
const isISRC: typeof validator.isISRC;
|
||||
export = isISRC;
|
||||
|
||||
@@ -35,6 +35,7 @@ import isIPFunc = require('validator/lib/isIP');
|
||||
import isISBNFunc = require('validator/lib/isISBN');
|
||||
import isISINFunc = require('validator/lib/isISIN');
|
||||
import isISO8601Func = require('validator/lib/isISO8601');
|
||||
import isISO31661Alpha2Func = require('validator/lib/isISO31661Alpha2');
|
||||
import isISRCFunc = require('validator/lib/isISRC');
|
||||
import isInFunc = require('validator/lib/isIn');
|
||||
import isIntFunc = require('validator/lib/isInt');
|
||||
@@ -161,6 +162,9 @@ import whitelistFunc = require('validator/lib/whitelist');
|
||||
let _isISO8601 = validator.isISO8601;
|
||||
_isISO8601 = isISO8601Func;
|
||||
|
||||
let _isISO31661Alpha2 = validator.isISO31661Alpha2;
|
||||
_isISO31661Alpha2 = isISO31661Alpha2Func;
|
||||
|
||||
let _isISRC = validator.isISRC;
|
||||
_isISRC = isISRCFunc;
|
||||
|
||||
@@ -450,6 +454,8 @@ let any: any;
|
||||
|
||||
result = validator.isISO8601('sample');
|
||||
|
||||
result = validator.isISO31661Alpha2('sample');
|
||||
|
||||
result = validator.isISRC('sample');
|
||||
|
||||
result = validator.isIn('sample', []);
|
||||
@@ -501,12 +507,14 @@ let any: any;
|
||||
result = validator.isMobilePhone('sample', 'es-ES');
|
||||
result = validator.isMobilePhone('sample', 'fa-IR');
|
||||
result = validator.isMobilePhone('sample', 'fi-FI');
|
||||
result = validator.isMobilePhone('sample', 'fo-FO');
|
||||
result = validator.isMobilePhone('sample', 'fr-FR');
|
||||
result = validator.isMobilePhone('sample', 'he-IL');
|
||||
result = validator.isMobilePhone('sample', 'hu-HU');
|
||||
result = validator.isMobilePhone('sample', 'id-ID');
|
||||
result = validator.isMobilePhone('sample', 'it-IT');
|
||||
result = validator.isMobilePhone('sample', 'ja-JP');
|
||||
result = validator.isMobilePhone('sample', 'kl-GL');
|
||||
result = validator.isMobilePhone('sample', 'ko-KR');
|
||||
result = validator.isMobilePhone('sample', 'lt-LT');
|
||||
result = validator.isMobilePhone('sample', 'ms-MY');
|
||||
|
||||
Reference in New Issue
Block a user