diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index e27b1e70c0..e91bd36ce2 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for validator.js v6.3 +// Type definitions for validator.js v9.4 // Project: https://github.com/chriso/validator.js // Definitions by: tgfjt // Ilya Mochalov @@ -6,13 +6,17 @@ // Louy Alakkad // Kacper Polak // Bonggyun Lee +// Naoto Yokoyama // 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" | "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"; - 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 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"; + 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"; + 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"; + 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"; + 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"; + 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" + type HashAlgorithm = "md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b"; interface ValidatorStatic { @@ -31,14 +35,16 @@ declare namespace ValidatorJS { // check if the string contains only letters (a-zA-Z). Locale is one of ['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']) and defaults to en-US + // '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']) and defaults to en-US isAlpha(str: string, locale?: AlphaLocale): boolean; // check if the string contains only letters and numbers. Locale is one of ['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']) and defaults to en-US + // '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']) and defaults to en-US isAlphanumeric(str: string, locale?: AlphanumericLocale): boolean; // check if the string contains ASCII chars only. @@ -66,11 +72,8 @@ declare namespace ValidatorJS { // check if the string is a data uri format (https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs) isDataURI(str: string): boolean; - // check if the string is a date. - isDate(str: string): boolean; - // check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc. - isDecimal(str: string): boolean; + isDecimal(str: string, options?: IsDecimalOptions): boolean; // check if the string is a number that's divisible by another. isDivisibleBy(str: string, number: number): boolean; @@ -93,6 +96,11 @@ declare namespace ValidatorJS { // check if the string contains any half-width chars. isHalfWidth(str: string): boolean; + // check if the string is a hash of type algorithm. + // Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', + // 'tiger160', 'tiger192', 'crc32', 'crc32b'] + isHash(str: string, algorithm: HashAlgorithm): boolean; + // check if the string is a hexadecimal color. isHexColor(str: string): boolean; @@ -105,6 +113,9 @@ declare namespace ValidatorJS { // check if the string is an ISBN (version 10 or 13). isISBN(str: string, version?: number): boolean; + // check if the string is an ISSN (https://en.wikipedia.org/wiki/International_Standard_Serial_Number). + isISSN(str: string, options?: IsISSNOptions): boolean; + // check if the string is an ISIN (https://en.wikipedia.org/wiki/International_Securities_Identification_Number) // (stock/security identifier). isISIN(str: string): boolean; @@ -112,6 +123,13 @@ 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; + // check if the string is in a array of allowed values. isIn(str: string, values: any[]): boolean; @@ -121,6 +139,9 @@ declare namespace ValidatorJS { // check if the string is valid JSON (note: uses JSON.parse). isJSON(str: string): boolean; + // check if the string is a valid latitude-longitude coordinate in the format lat,long or lat, long. + isLatLong(str: string): boolean; + // check if the string's length falls in a range. // Note: this function takes into account surrogate pairs. isLength(str: string, options: IsLengthOptions): boolean; @@ -135,12 +156,17 @@ declare namespace ValidatorJS { // check if the string is a MD5 hash. isMD5(str: string): boolean; + // check if the string matches to a valid MIME type (https://en.wikipedia.org/wiki/Media_type) format + isMimeType(str: string): boolean; + // 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', - // 'vi-VN', 'zh-CN', 'zh-TW']). - isMobilePhone(str: string, locale: MobilePhoneLocale): boolean; + // ['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']). + 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/). @@ -149,16 +175,16 @@ declare namespace ValidatorJS { // check if the string contains one or more multibyte chars. isMultibyte(str: string): boolean; - // check if the string is null. - isNull(str: string): boolean; - // check if the string contains only numbers. isNumeric(str: string): boolean; + // check if the string is a valid port number. + isPort(str: string): boolean; + // check if the string is a postal code, (locale is one of - // [ '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' ]) OR 'any'. If 'any' is used, function will check if any of the + // [ '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' ]) OR 'any'. If 'any' is used, function will check if any of the // locales match). isPostalCode(str: string, locale: PostalCodeLocale): boolean; @@ -262,12 +288,23 @@ declare namespace ValidatorJS { allow_negative_sign_placeholder?: boolean; thousands_separator?: string; decimal_separator?: string; + allow_decimal?: boolean; + require_decimal?: boolean; + digits_after_decimal?: number[]; allow_space_after_digits?: boolean; } + // options for isDecimal + interface IsDecimalOptions { + force_decimal?: boolean; + decimal_digits?: string; + locale?: DecimalLocale; + } + // options for isEmail interface IsEmailOptions { allow_display_name?: boolean; + require_display_name?: boolean; allow_utf8_local_part?: boolean; require_tld?: boolean; } @@ -283,6 +320,15 @@ declare namespace ValidatorJS { interface IsFloatOptions { min?: number; max?: number; + gt?: number; + lt?: number; + locale?: FloatLocale; + } + + // options for isISSN + interface IsISSNOptions { + case_sensitive?: boolean; + require_hyphen?: boolean; } // options for IsInt @@ -300,6 +346,11 @@ declare namespace ValidatorJS { max?: number; } + // options for isMobilePhone + interface IsMobilePhoneOptions { + strictMode?: boolean; + } + // options for isURL interface IsURLOptions { protocols?: string[]; @@ -316,9 +367,17 @@ declare namespace ValidatorJS { // options for normalizeEmail interface NormalizeEmailOptions { - lowercase?: boolean; - remove_dots?: boolean; - remove_extension?: boolean; + all_lowercase?: boolean; + gmail_lowercase?: boolean; + gmail_remove_dots?: boolean; + gmail_remove_subaddress?: boolean; + gmail_convert_googlemaildotcom?: boolean; + outlookdotcom_lowercase?: boolean; + outlookdotcom_remove_subaddress?: boolean; + yahoo_lowercase?: boolean; + yahoo_remove_subaddress?: boolean; + icloud_lowercase?: boolean; + icloud_remove_subaddress?: boolean; } } @@ -406,11 +465,6 @@ declare module "validator/lib/isDataURI" { export = isDataURI; } -declare module "validator/lib/isDate" { - const isDate: typeof validator.isDate; - export = isDate; -} - declare module "validator/lib/isDecimal" { const isDecimal: typeof validator.isDecimal; export = isDecimal; @@ -451,6 +505,11 @@ declare module "validator/lib/isHalfWidth" { export = isHalfWidth; } +declare module "validator/lib/isHash" { + const isHash: typeof validator.isHash; + export = isHash; +} + declare module "validator/lib/isHexColor" { const isHexColor: typeof validator.isHexColor; export = isHexColor; @@ -471,6 +530,11 @@ declare module "validator/lib/isISBN" { export = isISBN; } +declare module "validator/lib/isISSN" { + const isISSN: typeof validator.isISSN; + export = isISSN; +} + declare module "validator/lib/isISIN" { const isISIN: typeof validator.isISIN; export = isISIN; @@ -481,6 +545,16 @@ 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; +} + declare module "validator/lib/isIn" { const isIn: typeof validator.isIn; export = isIn; @@ -496,6 +570,11 @@ declare module "validator/lib/isJSON" { export = isJSON; } +declare module "validator/lib/isLatLong" { + const isLatLong: typeof validator.isLatLong; + export = isLatLong; +} + declare module "validator/lib/isLength" { const isLength: typeof validator.isLength; export = isLength; @@ -516,6 +595,11 @@ declare module "validator/lib/isMD5" { export = isMD5; } +declare module "validator/lib/isMimeType" { + const isMimeType: typeof validator.isMimeType; + export = isMimeType; +} + declare module "validator/lib/isMobilePhone" { const isMobilePhone: typeof validator.isMobilePhone; export = isMobilePhone; @@ -536,16 +620,16 @@ declare module "validator/lib/isMultibyte" { export = isMultibyte; } -declare module "validator/lib/isNull" { - const isNull: typeof validator.isNull; - export = isNull; -} - declare module "validator/lib/isNumeric" { const isNumeric: typeof validator.isNumeric; export = isNumeric; } +declare module "validator/lib/isPort" { + const isPort: typeof validator.isPort; + export = isPort; +} + declare module "validator/lib/isSurrogatePair" { const isSurrogatePair: typeof validator.isSurrogatePair; export = isSurrogatePair; diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 2bda229ea6..c3d4327d84 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -20,7 +20,6 @@ import isByteLengthFunc = require('validator/lib/isByteLength'); import isCreditCardFunc = require('validator/lib/isCreditCard'); import isCurrencyFunc = require('validator/lib/isCurrency'); import isDataURIFunc = require('validator/lib/isDataURI'); -import isDateFunc = require('validator/lib/isDate'); import isDecimalFunc = require('validator/lib/isDecimal'); import isDivisibleByFunc = require('validator/lib/isDivisibleBy'); import isEmailFunc = require('validator/lib/isEmail'); @@ -29,24 +28,30 @@ import isFQDNFunc = require('validator/lib/isFQDN'); import isFloatFunc = require('validator/lib/isFloat'); import isFullWidthFunc = require('validator/lib/isFullWidth'); import isHalfWidthFunc = require('validator/lib/isHalfWidth'); +import isHashFunc = require('validator/lib/isHash'); import isHexColorFunc = require('validator/lib/isHexColor'); import isHexadecimalFunc = require('validator/lib/isHexadecimal'); import isIPFunc = require('validator/lib/isIP'); import isISBNFunc = require('validator/lib/isISBN'); +import isISSNFunc = require('validator/lib/isISSN'); 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'); import isJSONFunc = require('validator/lib/isJSON'); +import isLatLongFunc = require('validator/lib/isLatLong'); import isLengthFunc = require('validator/lib/isLength'); import isLowercaseFunc = require('validator/lib/isLowercase'); import isMACAddressFunc = require('validator/lib/isMACAddress'); import isMD5Func = require('validator/lib/isMD5'); +import isMimeTypeFunc = require('validator/lib/isMimeType'); import isMobilePhoneFunc = require('validator/lib/isMobilePhone'); import isMongoIdFunc = require('validator/lib/isMongoId'); import isMultibyteFunc = require('validator/lib/isMultibyte'); -import isNullFunc = require('validator/lib/isNull'); import isNumericFunc = require('validator/lib/isNumeric'); +import isPortFunc = require('validator/lib/isPort'); import isPostalCodeFunc = require('validator/lib/isPostalCode'); import isSurrogatePairFunc = require('validator/lib/isSurrogatePair'); import isURLFunc = require('validator/lib/isURL'); @@ -113,9 +118,6 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isDataURI = validator.isDataURI; _isDataURI = isDataURIFunc; - let _isDate = validator.isDate; - _isDate = isDateFunc; - let _isDecimal = validator.isDecimal; _isDecimal = isDecimalFunc; @@ -140,6 +142,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isHalfWidth = validator.isHalfWidth; _isHalfWidth = isHalfWidthFunc; + let _isHash = validator.isHash; + _isHash = isHashFunc; + let _isHexColor = validator.isHexColor; _isHexColor = isHexColorFunc; @@ -152,12 +157,21 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isISBN = validator.isISBN; _isISBN = isISBNFunc; + let _isISSN = validator.isISSN; + _isISSN = isISSNFunc; + let _isISIN = validator.isISIN; _isISIN = isISINFunc; let _isISO8601 = validator.isISO8601; _isISO8601 = isISO8601Func; + let _isISO31661Alpha2 = validator.isISO31661Alpha2; + _isISO31661Alpha2 = isISO31661Alpha2Func; + + let _isISRC = validator.isISRC; + _isISRC = isISRCFunc; + let _isIn = validator.isIn; _isIn = isInFunc; @@ -167,6 +181,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isJSON = validator.isJSON; _isJSON = isJSONFunc; + let _isLatLong = validator.isLatLong; + _isLatLong = isLatLongFunc; + let _isLength = validator.isLength; _isLength = isLengthFunc; @@ -179,6 +196,9 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isMD5 = validator.isMD5; _isMD5 = isMD5Func; + let _isMimeType = validator.isMimeType; + _isMimeType = isMimeTypeFunc; + let _isMobilePhone = validator.isMobilePhone; _isMobilePhone = isMobilePhoneFunc; @@ -188,12 +208,12 @@ import whitelistFunc = require('validator/lib/whitelist'); let _isMultibyte = validator.isMultibyte; _isMultibyte = isMultibyteFunc; - let _isNull = validator.isNull; - _isNull = isNullFunc; - let _isNumeric = validator.isNumeric; _isNumeric = isNumericFunc; + let _isPort = validator.isPort; + _isPort = isPortFunc; + let _isPostalCode = validator.isPostalCode; _isPostalCode = isPostalCodeFunc; @@ -292,8 +312,11 @@ let any: any; result = validator.isAlpha('sample', 'ar-SY'); result = validator.isAlpha('sample', 'ar-TN'); result = validator.isAlpha('sample', 'ar-YE'); + result = validator.isAlpha('sample', 'bg-BG'); result = validator.isAlpha('sample', 'cs-CZ'); + result = validator.isAlpha('sample', 'da-DK'); result = validator.isAlpha('sample', 'de-DE'); + result = validator.isAlpha('sample', 'el-GR'); result = validator.isAlpha('sample', 'en-AU'); result = validator.isAlpha('sample', 'en-GB'); result = validator.isAlpha('sample', 'en-HK'); @@ -305,15 +328,22 @@ let any: any; result = validator.isAlpha('sample', 'es-ES'); result = validator.isAlpha('sample', 'fr-FR'); result = validator.isAlpha('sample', 'hu-HU'); + result = validator.isAlpha('sample', 'it-IT'); + result = validator.isAlpha('sample', 'nb-NO'); result = validator.isAlpha('sample', 'nl-NL'); + result = validator.isAlpha('sample', 'nn-NO'); result = validator.isAlpha('sample', 'pl-PL'); result = validator.isAlpha('sample', 'pt-BR'); result = validator.isAlpha('sample', 'pt-PT'); result = validator.isAlpha('sample', 'ru-RU'); + result = validator.isAlpha('sample', 'sk-SK'); result = validator.isAlpha('sample', 'sr-RS'); result = validator.isAlpha('sample', 'sr-RS@latin'); + result = validator.isAlpha('sample', 'sv-SE'); result = validator.isAlpha('sample', 'tr-TR'); + result = validator.isAlpha('sample', 'uk-UA'); + result = validator.isAlphanumeric('sample'); result = validator.isAlphanumeric('sample', 'ar'); result = validator.isAlphanumeric('sample', 'ar-AE'); result = validator.isAlphanumeric('sample', 'ar-BH'); @@ -332,8 +362,11 @@ let any: any; result = validator.isAlphanumeric('sample', 'ar-SY'); result = validator.isAlphanumeric('sample', 'ar-TN'); result = validator.isAlphanumeric('sample', 'ar-YE'); + result = validator.isAlphanumeric('sample', 'bg-BG'); result = validator.isAlphanumeric('sample', 'cs-CZ'); + result = validator.isAlphanumeric('sample', 'da-DK'); result = validator.isAlphanumeric('sample', 'de-DE'); + result = validator.isAlphanumeric('sample', 'el-GR'); result = validator.isAlphanumeric('sample', 'en-AU'); result = validator.isAlphanumeric('sample', 'en-GB'); result = validator.isAlphanumeric('sample', 'en-HK'); @@ -344,17 +377,21 @@ let any: any; result = validator.isAlphanumeric('sample', 'en-ZM'); result = validator.isAlphanumeric('sample', 'es-ES'); result = validator.isAlphanumeric('sample', 'fr-FR'); - result = validator.isAlphanumeric('sample', 'fr-BE'); result = validator.isAlphanumeric('sample', 'hu-HU'); - result = validator.isAlphanumeric('sample', 'nl-BE'); + result = validator.isAlphanumeric('sample', 'it-IT'); + result = validator.isAlphanumeric('sample', 'nb-NO'); result = validator.isAlphanumeric('sample', 'nl-NL'); + result = validator.isAlphanumeric('sample', 'nn-NO'); result = validator.isAlphanumeric('sample', 'pl-PL'); result = validator.isAlphanumeric('sample', 'pt-BR'); result = validator.isAlphanumeric('sample', 'pt-PT'); result = validator.isAlphanumeric('sample', 'ru-RU'); + result = validator.isAlphanumeric('sample', 'sk-SK'); result = validator.isAlphanumeric('sample', 'sr-RS'); result = validator.isAlphanumeric('sample', 'sr-RS@latin'); + result = validator.isAlphanumeric('sample', 'sv-SE'); result = validator.isAlphanumeric('sample', 'tr-TR'); + result = validator.isAlphanumeric('sample', 'uk-UA'); result = validator.isAscii('sample'); @@ -378,9 +415,9 @@ let any: any; result = validator.isDataURI('sample'); - result = validator.isDate('sample'); - + let isDecimalOptions: ValidatorJS.IsDecimalOptions; result = validator.isDecimal('sample'); + result = validator.isDecimal('sample', isDecimalOptions); result = validator.isDivisibleBy('sample', 2); @@ -388,6 +425,8 @@ let any: any; result = validator.isEmail('sample'); result = validator.isEmail('sample', isEmailOptions); + result = validator.isEmpty('sample'); + let isFQDNOptions: ValidatorJS.IsFQDNOptions; result = validator.isFQDN('sample'); result = validator.isFQDN('sample', isFQDNOptions); @@ -400,6 +439,20 @@ let any: any; result = validator.isHalfWidth('sample'); + result = validator.isHash('sample', 'md4'); + result = validator.isHash('sample', 'md5'); + result = validator.isHash('sample', 'sha1'); + result = validator.isHash('sample', 'sha256'); + result = validator.isHash('sample', 'sha384'); + result = validator.isHash('sample', 'sha512'); + result = validator.isHash('sample', 'ripemd128'); + result = validator.isHash('sample', 'ripemd160'); + result = validator.isHash('sample', 'tiger128'); + result = validator.isHash('sample', 'tiger160'); + result = validator.isHash('sample', 'tiger192'); + result = validator.isHash('sample', 'crc32'); + result = validator.isHash('sample', 'crc32b'); + result = validator.isHexColor('sample'); result = validator.isHexadecimal('sample'); @@ -410,10 +463,18 @@ let any: any; result = validator.isISBN('sample'); result = validator.isISBN('sample', 13); + let isISSNOptions: ValidatorJS.IsISSNOptions; + result = validator.isISSN('sample'); + result = validator.isISSN('sample', isISSNOptions); + result = validator.isISIN('sample'); result = validator.isISO8601('sample'); + result = validator.isISO31661Alpha2('sample'); + + result = validator.isISRC('sample'); + result = validator.isIn('sample', []); let isIntOptions: ValidatorJS.IsIntOptions; @@ -422,6 +483,8 @@ let any: any; result = validator.isJSON('sample'); + result = validator.isLatLong('sample'); + let isLengthOptions: ValidatorJS.IsLengthOptions; result = validator.isLength('sample', isLengthOptions); result = validator.isLength('sample', 3); @@ -433,9 +496,18 @@ let any: any; result = validator.isMD5('sample'); + 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'); + result = validator.isMobilePhone('sample', 'ar-JO'); result = validator.isMobilePhone('sample', 'ar-SA'); result = validator.isMobilePhone('sample', 'ar-SY'); + result = validator.isMobilePhone('sample', 'be-BY'); + result = validator.isMobilePhone('sample', 'bg-BG'); result = validator.isMobilePhone('sample', 'cs-CZ'); result = validator.isMobilePhone('sample', 'de-DE'); result = validator.isMobilePhone('sample', 'da-DK'); @@ -444,41 +516,62 @@ let any: any; result = validator.isMobilePhone('sample', 'en-GB'); result = validator.isMobilePhone('sample', 'en-HK'); result = validator.isMobilePhone('sample', 'en-IN'); + result = validator.isMobilePhone('sample', 'en-KE'); + result = validator.isMobilePhone('sample', 'en-NG'); result = validator.isMobilePhone('sample', 'en-NZ'); + result = validator.isMobilePhone('sample', 'en-UG'); + result = validator.isMobilePhone('sample', 'en-RW'); + result = validator.isMobilePhone('sample', 'en-SG'); + result = validator.isMobilePhone('sample', 'en-TZ'); + result = validator.isMobilePhone('sample', 'en-PK'); result = validator.isMobilePhone('sample', 'en-US'); result = validator.isMobilePhone('sample', 'en-CA'); result = validator.isMobilePhone('sample', 'en-ZA'); result = validator.isMobilePhone('sample', 'en-ZM'); 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', 'kk-KZ'); + result = validator.isMobilePhone('sample', 'kl-GL'); result = validator.isMobilePhone('sample', 'ko-KR'); + result = validator.isMobilePhone('sample', 'lt-LT'); result = validator.isMobilePhone('sample', 'ms-MY'); result = validator.isMobilePhone('sample', 'nb-NO'); result = validator.isMobilePhone('sample', 'nn-NO'); result = validator.isMobilePhone('sample', 'pl-PL'); result = validator.isMobilePhone('sample', 'pt-PT'); + result = validator.isMobilePhone('sample', 'ro-RO'); result = validator.isMobilePhone('sample', 'ru-RU'); result = validator.isMobilePhone('sample', 'sr-RS'); + result = validator.isMobilePhone('sample', 'sk-SK'); + result = validator.isMobilePhone('sample', 'th-TH'); result = validator.isMobilePhone('sample', 'tr-TR'); + result = validator.isMobilePhone('sample', 'uk-UA'); result = validator.isMobilePhone('sample', 'vi-VN'); result = validator.isMobilePhone('sample', 'zh-CN'); + result = validator.isMobilePhone('sample', 'zh-HK'); result = validator.isMobilePhone('sample', 'zh-TW'); + result = validator.isMobilePhone('sample', 'any'); result = validator.isMongoId('sample'); result = validator.isMultibyte('sample'); - result = validator.isNull('sample'); - result = validator.isNumeric('sample'); + result = validator.isPort('sample'); + result = validator.isPostalCode('sample', 'AT'); result = validator.isPostalCode('sample', 'AU'); result = validator.isPostalCode('sample', 'BE'); + result = validator.isPostalCode('sample', 'BG'); result = validator.isPostalCode('sample', 'CA'); result = validator.isPostalCode('sample', 'CH'); result = validator.isPostalCode('sample', 'CZ');