From 3d60af8fb220f17a53c202ceb6edf4c55f74ef27 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Tue, 19 Nov 2019 02:38:42 +0600 Subject: [PATCH] [validator]: update for validator@12.0.0 (#40192) * [validator]: update for validator@12.0.0 * update tsconfig.json * fix dependents: sequelize * tweak dependents: sequelize --- types/sequelize/index.d.ts | 9 +- types/sequelize/v3/index.d.ts | 9 +- types/validator/index.d.ts | 1635 ++++++++++++++++----- types/validator/lib/blacklist.d.ts | 4 +- types/validator/lib/contains.d.ts | 4 +- types/validator/lib/equals.d.ts | 4 +- types/validator/lib/escape.d.ts | 4 +- types/validator/lib/isAfter.d.ts | 4 +- types/validator/lib/isAlpha.d.ts | 4 +- types/validator/lib/isAlphanumeric.d.ts | 4 +- types/validator/lib/isAscii.d.ts | 4 +- types/validator/lib/isBIC.d.ts | 1 + types/validator/lib/isBase32.d.ts | 1 + types/validator/lib/isBase64.d.ts | 4 +- types/validator/lib/isBefore.d.ts | 4 +- types/validator/lib/isBoolean.d.ts | 4 +- types/validator/lib/isByteLength.d.ts | 4 +- types/validator/lib/isCreditCard.d.ts | 4 +- types/validator/lib/isCurrency.d.ts | 4 +- types/validator/lib/isDataURI.d.ts | 4 +- types/validator/lib/isDecimal.d.ts | 4 +- types/validator/lib/isDivisibleBy.d.ts | 4 +- types/validator/lib/isEmail.d.ts | 4 +- types/validator/lib/isEmpty.d.ts | 4 +- types/validator/lib/isFQDN.d.ts | 4 +- types/validator/lib/isFloat.d.ts | 4 +- types/validator/lib/isFullWidth.d.ts | 4 +- types/validator/lib/isHalfWidth.d.ts | 4 +- types/validator/lib/isHash.d.ts | 4 +- types/validator/lib/isHexColor.d.ts | 4 +- types/validator/lib/isHexadecimal.d.ts | 4 +- types/validator/lib/isIP.d.ts | 4 +- types/validator/lib/isIPRange.d.ts | 1 + types/validator/lib/isISBN.d.ts | 4 +- types/validator/lib/isISIN.d.ts | 4 +- types/validator/lib/isISO31661Alpha2.d.ts | 4 +- types/validator/lib/isISO31661Alpha3.d.ts | 4 +- types/validator/lib/isISO8601.d.ts | 4 +- types/validator/lib/isISRC.d.ts | 4 +- types/validator/lib/isISSN.d.ts | 4 +- types/validator/lib/isIdentityCard.d.ts | 1 + types/validator/lib/isIn.d.ts | 4 +- types/validator/lib/isInt.d.ts | 4 +- types/validator/lib/isJSON.d.ts | 4 +- types/validator/lib/isJWT.d.ts | 4 +- types/validator/lib/isLatLong.d.ts | 4 +- types/validator/lib/isLength.d.ts | 4 +- types/validator/lib/isLowercase.d.ts | 4 +- types/validator/lib/isMACAddress.d.ts | 4 +- types/validator/lib/isMD5.d.ts | 4 +- types/validator/lib/isMagnetURI.d.ts | 1 + types/validator/lib/isMimeType.d.ts | 4 +- types/validator/lib/isMobilePhone.d.ts | 4 +- types/validator/lib/isMongoId.d.ts | 4 +- types/validator/lib/isMultibyte.d.ts | 4 +- types/validator/lib/isNumeric.d.ts | 4 +- types/validator/lib/isOctal.d.ts | 1 + types/validator/lib/isPort.d.ts | 4 +- types/validator/lib/isPostalCode.d.ts | 4 +- types/validator/lib/isRFC3339.d.ts | 1 + types/validator/lib/isSlug.d.ts | 1 + types/validator/lib/isSurrogatePair.d.ts | 4 +- types/validator/lib/isURL.d.ts | 4 +- types/validator/lib/isUUID.d.ts | 4 +- types/validator/lib/isUppercase.d.ts | 4 +- types/validator/lib/isVariableWidth.d.ts | 4 +- types/validator/lib/isWhitelisted.d.ts | 4 +- types/validator/lib/ltrim.d.ts | 4 +- types/validator/lib/matches.d.ts | 4 +- types/validator/lib/normalizeEmail.d.ts | 4 +- types/validator/lib/rtrim.d.ts | 4 +- types/validator/lib/stripLow.d.ts | 4 +- types/validator/lib/toBoolean.d.ts | 4 +- types/validator/lib/toDate.d.ts | 4 +- types/validator/lib/toFloat.d.ts | 4 +- types/validator/lib/toInt.d.ts | 4 +- types/validator/lib/trim.d.ts | 4 +- types/validator/lib/unescape.d.ts | 4 +- types/validator/lib/whitelist.d.ts | 4 +- types/validator/tsconfig.json | 30 +- types/validator/tslint.json | 79 +- types/validator/validator-tests.ts | 1080 +++++++------- 82 files changed, 1871 insertions(+), 1251 deletions(-) create mode 100644 types/validator/lib/isBIC.d.ts create mode 100644 types/validator/lib/isBase32.d.ts create mode 100644 types/validator/lib/isIPRange.d.ts create mode 100644 types/validator/lib/isIdentityCard.d.ts create mode 100644 types/validator/lib/isMagnetURI.d.ts create mode 100644 types/validator/lib/isOctal.d.ts create mode 100644 types/validator/lib/isRFC3339.d.ts create mode 100644 types/validator/lib/isSlug.d.ts diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 55bcfdd30d..48926ebfdc 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -31,13 +31,12 @@ // Based on original work by: samuelneff -/// - - import * as _ from "lodash"; import Promise = require("bluebird"); import * as cls from "continuation-local-storage" +import * as ValidatorJS from 'validator' + type Omit = Pick> declare namespace sequelize { @@ -6339,10 +6338,12 @@ declare namespace sequelize { // Validator // ~~~~~~~~~~~ + type ValidatorJSType = typeof ValidatorJS + /** * Validator Interface */ - interface Validator extends ValidatorJS.ValidatorStatic { + interface Validator extends ValidatorJSType { notEmpty(str: string): boolean; len(str: string, min: number, max: number): boolean; diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 6ff8966c0d..9c97fb99c8 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -10,12 +10,11 @@ // Based on original work by: samuelneff -/// - - import * as _ from "lodash"; import * as Promise from "bluebird"; +import * as ValidatorJS from 'validator' + declare namespace sequelize { // @@ -5797,10 +5796,12 @@ declare namespace sequelize { // Validator // ~~~~~~~~~~~ + type ValidatorJSType = typeof ValidatorJS + /** * Validator Interface */ - interface Validator extends ValidatorJS.ValidatorStatic { + interface Validator extends ValidatorJSType { notEmpty(str: string): boolean; len(str: string, min: number, max: number): boolean; diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 062fc19a15..842fcabbe2 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -1,5 +1,5 @@ -// Type definitions for validator.js v10.11.0 -// Project: https://github.com/chriso/validator.js +// Type definitions for validator.js 12.0 +// Project: https://github.com/validatorjs/validator.js // Definitions by: tgfjt // Ilya Mochalov // Ayman Nedjmeddine @@ -9,416 +9,1241 @@ // Naoto Yokoyama // Philipp Katz // Jace Warren +// Munif Tanjim // 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" | "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 { - - // ************** - // * Validators * - // ************** - - // check if the string contains the seed. - contains(str: string, elem: any): boolean; - - // check if the string matches the comparison. - equals(str: string, comparison: string): boolean; - - // check if the string is a date that's after the specified date (defaults to now). - isAfter(str: string, date?: string): boolean; - - // 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', - // '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', - // '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. - isAscii(str: string): boolean; - - // check if a string is base64 encoded. - isBase64(str: string): boolean; - - // check if the string is a date that's before the specified date. - isBefore(str: string, date?: string): boolean; - - // check if a string is a boolean. - isBoolean(str: string): boolean; - - // check if the string's length (in bytes) falls in a range. - isByteLength(str: string, options: IsByteLengthOptions): boolean; - isByteLength(str: string, min: number, max?: number): boolean; - - // check if the string is a credit card. - isCreditCard(str: string): boolean; - - // check if the string is a valid currency amount. - isCurrency(str: string, options?: IsCurrencyOptions): boolean; - - // 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 represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc. - isDecimal(str: string, options?: IsDecimalOptions): boolean; - - // check if the string is a number that's divisible by another. - isDivisibleBy(str: string, number: number): boolean; - - // check if the string is an email. - isEmail(str: string, options?: IsEmailOptions): boolean; - - // check if the string has a length of zero. - isEmpty(str: string, options?: IsEmptyOptions): boolean; - - // check if the string is a fully qualified domain name (e.g. domain.com). - isFQDN(str: string, options?: IsFQDNOptions): boolean; - - // check if the string is a float. - isFloat(str: string, options?: IsFloatOptions): boolean; - - // check if the string contains any full-width chars. - isFullWidth(str: string): boolean; - - // 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; - - // check if the string is a hexadecimal number. - isHexadecimal(str: string): boolean; - - // check if the string is an IP (version 4 or 6). - isIP(str: string, version?: number): boolean; - - // 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; - - // check if the string is a valid ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601) date. - isISO8601(str: string, options?: IsISO8601Options): 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 valid ISO 3166-1 alpha-3 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned - // country code. - isISO31661Alpha3(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; - - // check if the string is an integer. - isInt(str: string, options?: IsIntOptions): boolean; - - // check if the string is valid JSON (note: uses JSON.parse). - isJSON(str: string): boolean; - - // check if the string is valid JWT token. - isJWT(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; - isLength(str: string, min: number, max?: number): boolean; - - // check if the string is lowercase. - isLowercase(str: string): boolean; - - // check if the string is a MAC address. - isMACAddress(str: string): boolean; - - // 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 either an array of locales or one of - // ['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'] or defaults to 'any'). - isMobilePhone(str: string, locale?: MobilePhoneLocale | 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/). - isMongoId(str: string): boolean; - - // check if the string contains one or more multibyte chars. - isMultibyte(str: string): boolean; - - // check if the string contains only numbers. - isNumeric(str: string, options?: IsNumericOptions): 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', '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; - - // check if the string contains any surrogate pairs chars. - isSurrogatePair(str: string): boolean; - - // check if the string is an URL. - isURL(str: string, options?: IsURLOptions): boolean; - - // check if the string is a UUID. Must be one of ['3', '4', '5', 'all'], default is all. - isUUID(str: string, version?: 3|4|5|"3"|"4"|"5"|"all"): boolean; - - // check if the string is uppercase. - isUppercase(str: string): boolean; - - // check if the string contains a mixture of full and half-width chars. - isVariableWidth(str: string): boolean; - - // checks characters if they appear in the whitelist. - isWhitelisted(str: string, chars: string | string[]): boolean; - - // check if string matches the pattern. - matches(str: string, pattern: RegExp | string, modifiers?: string): boolean; - - // ************** - // * Sanitizers * - // ************** - - // remove characters that appear in the blacklist. The characters are used in a RegExp and so you will need - // to escape some chars, e.g. blacklist(input, '\\[\\]'). - blacklist(input: string, chars: string): string; - - // replace <, >, &, ', " and / with HTML entities. - escape(input: string): string; - - // replaces HTML encoded entities with <, >, &, ', " and /. - unescape(input: string): string; - - // trim characters from the left-side of the input. - ltrim(input: string, chars?: string): string; - - // canonicalize an email address. - normalizeEmail(email: string, options?: NormalizeEmailOptions): string | false; - - // trim characters from the right-side of the input. - rtrim(input: string, chars?: string): string; - - // remove characters with a numerical value < 32 and 127, mostly control characters. If keep_new_lines is true, - // newline characters are preserved (\n and \r, hex 0xA and 0xD). Unicode-safe in JavaScript. - stripLow(input: string, keep_new_lines?: boolean): string; - - // convert the input to a boolean. Everything except for '0', 'false' and '' returns true. In strict mode only '1' - // and 'true' return true. - toBoolean(input: string, strict?: boolean): boolean; - - // convert the input to a date, or null if the input is not a date. - toDate(input: string): Date; // Date or null - - // convert the input to a float, or NaN if the input is not a float. - toFloat(input: string): number; // number or NaN - - // convert the input to an integer, or NaN if the input is not an integer. - toInt(input: string, radix?: number): number; // number or NaN - - // trim characters (whitespace by default) from both sides of the input. - trim(input: string, chars?: string): string; - - // remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will - // need to escape some chars, e.g. whitelist(input, '\\[\\]'). - whitelist(input: string, chars: string): string; - - toString(input: any | any[]): string; - - version: string; - - // ************** - // * Extensions * - // ************** - - // add your own validators. - // Note: that the first argument will be automatically coerced to a string. - extend(name: string, fn: T): void; - } - - // options for IsByteLength - interface IsByteLengthOptions { +// TypeScript Version: 2.1 + +export const version: string; + +/****************** + *** Validators *** + ******************/ + +/** + * Check if the string contains the seed. + * + * @param seed - Seed + */ +export function contains(str: string, seed: any): boolean; + +/** + * Check if the string matches the comparison. + * + * @param comparison - String to compare + */ +export function equals(str: string, comparison: string): boolean; + +/** + * Check if the string is a date that's after the specified date. + * + * @param [date] - Date string (defaults to now) + */ +export function isAfter(str: string, date?: string): boolean; + +export type AlphaLocale = + | 'en-US' + | 'bg-BG' + | 'cs-CZ' + | 'da-DK' + | 'de-DE' + | 'el-GR' + | 'es-ES' + | 'fr-FR' + | 'it-IT' + | 'nb-NO' + | 'nl-NL' + | 'nn-NO' + | 'hu-HU' + | 'pl-PL' + | 'pt-PT' + | 'ru-RU' + | 'sl-SI' + | 'sk-SK' + | 'sr-RS@latin' + | 'sr-RS' + | 'sv-SE' + | 'tr-TR' + | 'uk-UA' + | 'ku-IQ' + | 'ar' + | 'he' + | 'fa-IR' + | 'en-AU' + | 'en-GB' + | 'en-HK' + | 'en-IN' + | 'en-NZ' + | 'en-ZA' + | 'en-ZM' + | 'ar-AE' + | 'ar-BH' + | 'ar-DZ' + | 'ar-EG' + | 'ar-IQ' + | 'ar-JO' + | 'ar-KW' + | 'ar-LB' + | 'ar-LY' + | 'ar-MA' + | 'ar-QM' + | 'ar-QA' + | 'ar-SA' + | 'ar-SD' + | 'ar-SY' + | 'ar-TN' + | 'ar-YE' + | 'pt-BR' + | 'pl-Pl'; + +export const isAlphaLocales: AlphaLocale[]; + +/** + * Check if the string contains only letters (a-zA-Z). + * + * @param [locale] - AlphaLocale + */ +export function isAlpha(str: string, locale?: AlphaLocale): boolean; + +export type AlphanumericLocale = + | 'en-US' + | 'bg-BG' + | 'cs-CZ' + | 'da-DK' + | 'de-DE' + | 'el-GR' + | 'es-ES' + | 'fr-FR' + | 'it-IT' + | 'hu-HU' + | 'nb-NO' + | 'nl-NL' + | 'nn-NO' + | 'pl-PL' + | 'pt-PT' + | 'ru-RU' + | 'sl-SI' + | 'sk-SK' + | 'sr-RS@latin' + | 'sr-RS' + | 'sv-SE' + | 'tr-TR' + | 'uk-UA' + | 'ku-IQ' + | 'ar' + | 'he' + | 'fa-IR' + | 'en-AU' + | 'en-GB' + | 'en-HK' + | 'en-IN' + | 'en-NZ' + | 'en-ZA' + | 'en-ZM' + | 'ar-AE' + | 'ar-BH' + | 'ar-DZ' + | 'ar-EG' + | 'ar-IQ' + | 'ar-JO' + | 'ar-KW' + | 'ar-LB' + | 'ar-LY' + | 'ar-MA' + | 'ar-QM' + | 'ar-QA' + | 'ar-SA' + | 'ar-SD' + | 'ar-SY' + | 'ar-TN' + | 'ar-YE' + | 'pt-BR' + | 'pl-Pl'; + +export const isAlphanumericLocales: AlphanumericLocale[]; + +/** + * Check if the string contains only letters and numbers. + * + * @param [locale] - AlphanumericLocale + */ +export function isAlphanumeric(str: string, locale?: AlphanumericLocale): boolean; + +/** + * Check if the string contains ASCII chars only. + */ +export function isAscii(str: string): boolean; + +/** + * Check if a string is base32 encoded. + */ +export function isBase32(str: string): boolean; + +/** + * Check if a string is base64 encoded. + */ +export function isBase64(str: string): boolean; + +/** + * Check if the string is a date that's before the specified date. + * + * @param [date] - Date string (defaults to now) + */ +export function isBefore(str: string, date?: string): boolean; + +/** + * Check if a string is a BIC (Bank Identification Code) or SWIFT code. + */ +export function isBIC(str: string): boolean; + +/** + * check if a string is a boolean. + */ +export function isBoolean(str: string): boolean; + +export interface IsByteLengthOptions { + /** + * @default 0 + */ min?: number; + /** + * @default undefined + */ max?: number; - } - - // options for IsCurrency - interface IsCurrencyOptions { - symbol?: string; - require_symbol?: boolean; - allow_space_after_symbol?: boolean; - symbol_after_digits?: boolean; - allow_negatives?: boolean; - parens_for_negatives?: boolean; - negative_sign_before_digits?: boolean; - negative_sign_after_digits?: boolean; - 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; - } - - // options for isEmpty - interface IsEmptyOptions { - ignore_whitespace?: boolean; - } - - // options for isFQDN - interface IsFQDNOptions { - require_tld?: boolean; - allow_underscores?: boolean; - allow_trailing_dot?: boolean; - } - - // options for IsFloat - 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 - interface IsIntOptions { - min?: number; - max?: number; - allow_leading_zeroes?: boolean; - lt?: number; - gt?: number; - } - - // options for isISO8601 - interface IsISO8601Options { - strict?: boolean; - } - - // options for IsLength - interface IsLengthOptions { - min?: number; - max?: number; - } - - // options for isMobilePhone - interface IsMobilePhoneOptions { - strictMode?: boolean; - } - - // options for isURL - interface IsURLOptions { - protocols?: string[]; - require_tld?: boolean; - require_protocol?: boolean; - require_host?: boolean; - require_valid_protocol?: boolean; - allow_underscores?: boolean; - host_whitelist?: (string | RegExp)[]; - host_blacklist?: (string | RegExp)[]; - allow_trailing_dot?: boolean; - allow_protocol_relative_urls?: boolean; - disallow_auth?: boolean; - } - - // options for normalizeEmail - interface NormalizeEmailOptions { - 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; - } - - /** - * Options for isNumeric - */ - interface IsNumericOptions { - no_symbols?: boolean; - } } /** - * MODULES + * Check if the string's length (in UTF-8 bytes) falls in a range. + * + * @param [options] - Options */ -declare var validator: ValidatorJS.ValidatorStatic; +export function isByteLength(str: string, options?: IsByteLengthOptions): boolean; -declare module "validator" { - export = validator; +/** + * Check if the string is a credit card. + */ +export function isCreditCard(str: string): boolean; + +export interface IsCurrencyOptions { + /** + * @default '$' + */ + symbol?: string; + /** + * @default false + */ + require_symbol?: boolean; + /** + * @default false + */ + allow_space_after_symbol?: boolean; + /** + * @default false + */ + symbol_after_digits?: boolean; + /** + * @default true + */ + allow_negatives?: boolean; + /** + * @default false + */ + parens_for_negatives?: boolean; + /** + * @default false + */ + negative_sign_before_digits?: boolean; + /** + * @default false + */ + negative_sign_after_digits?: boolean; + /** + * @default false + */ + allow_negative_sign_placeholder?: boolean; + /** + * @default ',' + */ + thousands_separator?: string; + /** + * @default '.' + */ + decimal_separator?: string; + /** + * @default true + */ + allow_decimal?: boolean; + /** + * @default false + */ + require_decimal?: boolean; + /** + * The array `digits_after_decimal` is filled with the exact number of digits allowed not a range, for example a range `1` to `3` will be given as `[1, 2, 3]`. + * + * @default [2] + */ + digits_after_decimal?: number[]; + /** + * @default false + */ + allow_space_after_digits?: boolean; } -// deprecated interfaces for backward compatibility, please use ValidatorJS.* instead the ones -interface IValidatorStatic extends ValidatorJS.ValidatorStatic { } -interface IURLoptions extends ValidatorJS.IsURLOptions { } -interface IFQDNoptions extends ValidatorJS.IsFQDNOptions { } -interface IEmailoptions extends ValidatorJS.NormalizeEmailOptions { } +/** + * Check if the string is a valid currency amount. + * + * @param [options] - Options + */ +export function isCurrency(str: string, options?: IsCurrencyOptions): boolean; + +/** + * Check if the string is a [data uri format](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs). + */ +export function isDataURI(str: string): boolean; + +export type DecimalLocale = FloatLocale; + +export interface IsDecimalOptions { + /** + * @default false + */ + force_decimal?: boolean; + /** + * `decimal_digits` is given as a range like `'1,3'`, + * a specific value like `'3'` or min like `'1,'` + * + * @default '1,' + */ + decimal_digits?: string; + /** + * DecimalLocale + * + * @default 'en-US' + */ + locale?: DecimalLocale; +} + +/** + * Check if the string represents a decimal number, + * such as `0.1`, `.3`, `1.1`, `1.00003`, `4.0` etc. + * + * @param [options] - Options + */ +export function isDecimal(str: string, options?: IsDecimalOptions): boolean; + +/** + * Check if the string is a number that's divisible by another. + * + * @param number - Divider number + */ +export function isDivisibleBy(str: string, number: number): boolean; + +export interface IsEmailOptions { + /** + * If `allow_display_name` is set to `true`, the validator will also match `Display Name `. + * + * @default false + */ + allow_display_name?: boolean; + /** + * If `require_display_name` is set to `true`, the validator will reject strings without the format `Display Name `. + * + * @default false + */ + require_display_name?: boolean; + /** + * If `allow_utf8_local_part` is set to `false`, the validator will not allow any non-English UTF8 character in email address' local part. + * + * @default true + */ + allow_utf8_local_part?: boolean; + /** + * If `require_tld` is set to `false`, e-mail addresses without having TLD in their domain will also be matched. + * + * @default true + */ + require_tld?: boolean; + /** + * If `ignore_max_length` is set to `true`, the validator will not check for the standard max length of an email. + * + * @default false + */ + ignore_max_length?: boolean; + /** + * If `allow_ip_domain` is set to `true`, the validator will allow IP addresses in the host part. + * + * @default false + */ + allow_ip_domain?: boolean; + /** + * If `domain_specific_validation` is `true`, some additional validation will be enabled, + * e.g. disallowing certain syntactically valid email addresses that are rejected by GMail. + * + * @default false + */ + domain_specific_validation?: boolean; +} + +/** + * Check if the string is an email. + * + * @param [options] - Options + */ +export function isEmail(str: string, options?: IsEmailOptions): boolean; + +export interface IsEmptyOptions { + /** + * @default false + */ + ignore_whitespace?: boolean; +} + +/** + * Check if the string has a length of zero. + * + * @param [options] - Options + */ +export function isEmpty(str: string, options?: IsEmptyOptions): boolean; + +export type FloatLocale = + | 'en-US' + | 'ar' + | 'en-AU' + | 'en-GB' + | 'en-HK' + | 'en-IN' + | 'en-NZ' + | 'en-ZA' + | 'en-ZM' + | 'ar-AE' + | 'ar-BH' + | 'ar-DZ' + | 'ar-EG' + | 'ar-IQ' + | 'ar-JO' + | 'ar-KW' + | 'ar-LB' + | 'ar-LY' + | 'ar-MA' + | 'ar-QM' + | 'ar-QA' + | 'ar-SA' + | 'ar-SD' + | 'ar-SY' + | 'ar-TN' + | 'ar-YE' + | 'bg-BG' + | 'cs-CZ' + | 'da-DK' + | 'de-DE' + | 'el-GR' + | 'es-ES' + | 'fr-FR' + | 'it-IT' + | 'ku-IQ' + | 'hu-HU' + | 'nb-NO' + | 'nn-NO' + | 'nl-NL' + | 'pl-PL' + | 'pt-PT' + | 'ru-RU' + | 'sl-SI' + | 'sr-RS@latin' + | 'sr-RS' + | 'sv-SE' + | 'tr-TR' + | 'uk-UA' + | 'pt-BR' + | 'pl-Pl'; + +export const isFloatLocales: FloatLocale[]; + +export interface IsFloatOptions { + /** + * less or equal + */ + min?: number; + /** + * greater or equal + */ + max?: number; + /** + * greater than + */ + gt?: number; + /** + * less than + */ + lt?: number; + /** + * FloatLocale + */ + locale?: FloatLocale; +} + +/** + * Check if the string is a float. + * + * @param [options] - Options + */ +export function isFloat(str: string, options?: IsFloatOptions): boolean; + +export interface IsFQDNOptions { + /** + * @default true + */ + require_tld?: boolean; + /** + * @default false + */ + allow_underscores?: boolean; + /** + * @default false + */ + allow_trailing_dot?: boolean; +} + +/** + * Check if the string is a fully qualified domain name (e.g. `domain.com`). + * + * @param [options] - Options + */ +export function isFQDN(str: string, options?: IsFQDNOptions): boolean; + +/** + * Check if the string contains any full-width chars. + */ +export function isFullWidth(str: string): boolean; + +/** + * Check if the string contains any half-width chars. + */ +export function isHalfWidth(str: string): boolean; + +export type HashAlgorithm = + | 'md4' + | 'md5' + | 'sha1' + | 'sha256' + | 'sha384' + | 'sha512' + | 'ripemd128' + | 'ripemd160' + | 'tiger128' + | 'tiger160' + | 'tiger192' + | 'crc32' + | 'crc32b'; + +/** + * Check if the string is a hash of type algorithm. + * + * @param algorithm - HashAlgorithm + */ +export function isHash(str: string, algorithm: HashAlgorithm): boolean; + +/** + * Check if the string is a hexadecimal number. + */ +export function isHexadecimal(str: string): boolean; + +/** + * Check if the string is a hexadecimal color. + */ +export function isHexColor(str: string): boolean; + +export type IdentityCardLocale = 'ES' | 'he-IL' | 'zh-TW'; + +/** + * Check if the string is a valid identity card code. + * + * @param [locale="any"] - IdentityCardLocale + */ +export function isIdentityCard(str: string, locale?: 'any' | IdentityCardLocale): boolean; + +/** + * Check if the string is in a array of allowed values. + * + * @param values - Allowed values. + */ +export function isIn(str: string, values: any[]): boolean; + +export interface IsIntOptions { + /** + * to check the integer min boundary + */ + min?: number; + /** + * to check the integer max boundary + */ + max?: number; + /** + * if `false`, will disallow integer values with leading zeroes + * @default true + */ + allow_leading_zeroes?: boolean; + /** + * enforce integers being greater than the value provided + */ + lt?: number; + /** + * enforce integers being less than the value provided + */ + gt?: number; +} + +/** + * Check if the string is an integer. + * + * @param [options] - Options + */ +export function isInt(str: string, options?: IsIntOptions): boolean; + +/** + * Check if the string is an IP (version 4 or 6). + * + * @param [version] - IP Version + */ +export function isIP(str: string, version?: '4' | '6'): boolean; + +/** + * Check if the string is an IP Range (version 4 only). + */ +export function isIPRange(str: string): boolean; + +/** + * Check if the string is an ISBN (version 10 or 13). + * + * @param [version] - ISBN Version + */ +export function isISBN(str: string, version?: '10' | '13'): boolean; + +/** + * Check if the string is an [ISIN](https://en.wikipedia.org/wiki/International_Securities_Identification_Number) (stock/security identifier). + */ +export function isISIN(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. + */ +export function isISO31661Alpha2(str: string): boolean; + +/** + * Check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code. + */ +export function isISO31661Alpha3(str: string): boolean; + +export interface IsISO8601Options { + /** + * If `strict` is `true`, performs additional checks for valid dates, + * e.g. invalidates dates like `2009-02-29`. + * + * @default false + */ + strict?: boolean; +} + +/** + * Check if the string is a valid [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date. + * + * @param [options] - Options + */ +export function isISO8601(str: string, options?: IsISO8601Options): boolean; + +export interface IsISSNOptions { + /** + * If `case_sensitive` is `true`, ISSNs with a lowercase `x` as the check digit are rejected. + * + * @default false + */ + case_sensitive?: boolean; + /** + * @default false + */ + require_hyphen?: boolean; +} + +/** + * Check if the string is an [ISSN](https://en.wikipedia.org/wiki/International_Standard_Serial_Number). + * + * @param [options] - Options + */ +export function isISSN(str: string, options?: IsISSNOptions): boolean; + +/** + * Check if the string is a [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code). + */ +export function isISRC(str: string): boolean; + +/** + * Check if the string is a valid [RFC 3339](https://tools.ietf.org/html/rfc3339) date. + */ +export function isRFC3339(str: string): boolean; + +/** + * Check if the string is valid JSON (note: uses `JSON.parse`). + */ +export function isJSON(str: string): boolean; + +/** + * Check if the string is valid JWT token. + */ +export function isJWT(str: string): boolean; + +/** + * Check if the string is a valid latitude-longitude coordinate in the format: + * + * `lat,long` or `lat, long`. + */ +export function isLatLong(str: string): boolean; + +export interface IsLengthOptions { + /** + * @default 0 + */ + min?: number; + /** + * @default undefined + */ + max?: number; +} + +/** + * Check if the string's length falls in a range. + * + * Note: this function takes into account surrogate pairs. + * + * @param [options] - Options + */ +export function isLength(str: string, options?: IsLengthOptions): boolean; + +/** + * Check if the string is lowercase. + */ +export function isLowercase(str: string): boolean; + +export interface IsMACAddressOptions { + /** + * If `no_colons` is `true`, the validator will allow MAC addresses without the colons. + * Also, it allows the use of hyphens or spaces. + * + * e.g. `01 02 03 04 05 ab` or `01-02-03-04-05-ab`. + * + * @default false + */ + no_colons?: boolean; +} + +/** + * Check if the string is a MAC address. + * + * @param [options] - Options + */ +export function isMACAddress(str: string, options?: IsMACAddressOptions): boolean; + +/** + * Check if the string is a [magnet uri format](https://en.wikipedia.org/wiki/Magnet_URI_scheme). + */ +export function isMagnetURI(str: string): boolean; + +/** + * Check if the string is a MD5 hash. + */ +export function isMD5(str: string): boolean; + +/** + * Check if the string matches to a valid [MIME type](https://en.wikipedia.org/wiki/Media_type) format. + */ +export function isMimeType(str: string): boolean; + +export type MobilePhoneLocale = + | 'ar-AE' + | 'ar-BH' + | 'ar-DZ' + | 'ar-EG' + | 'ar-IQ' + | 'ar-JO' + | 'ar-KW' + | 'ar-SA' + | 'ar-SY' + | 'ar-TN' + | 'be-BY' + | 'bg-BG' + | 'bn-BD' + | 'cs-CZ' + | 'da-DK' + | 'de-DE' + | 'de-AT' + | 'el-GR' + | 'en-AU' + | 'en-GB' + | 'en-GG' + | 'en-GH' + | 'en-HK' + | 'en-IE' + | 'en-IN' + | 'en-KE' + | 'en-MT' + | 'en-MU' + | 'en-NG' + | 'en-NZ' + | 'en-PK' + | 'en-RW' + | 'en-SG' + | 'en-TZ' + | 'en-UG' + | 'en-US' + | 'en-ZA' + | 'en-ZM' + | 'es-CL' + | 'es-ES' + | 'es-MX' + | 'es-PA' + | 'es-PY' + | 'es-UY' + | 'et-EE' + | 'fa-IR' + | 'fi-FI' + | 'fj-FJ' + | 'fo-FO' + | 'fr-FR' + | 'fr-GF' + | 'fr-GP' + | 'fr-MQ' + | 'fr-RE' + | 'he-IL' + | 'hu-HU' + | 'id-ID' + | 'it-IT' + | 'ja-JP' + | 'kk-KZ' + | 'kl-GL' + | 'ko-KR' + | 'lt-LT' + | 'ms-MY' + | 'nb-NO' + | 'nl-BE' + | 'nl-NL' + | 'nn-NO' + | 'pl-PL' + | 'pt-BR' + | 'pt-PT' + | 'ro-RO' + | 'ru-RU' + | 'sl-SI' + | 'sk-SK' + | 'sr-RS' + | 'sv-SE' + | 'th-TH' + | 'tr-TR' + | 'uk-UA' + | 'vi-VN' + | 'zh-CN' + | 'zh-TW' + | 'en-CA' + | 'fr-BE' + | 'zh-HK'; + +export const isMobilePhoneLocales: MobilePhoneLocale[]; + +export interface IsMobilePhoneOptions { + /** + * If this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`. + * + * @default false + */ + strictMode?: boolean; +} + +/** + * Check if the string is a mobile phone number. + * + * @param [locale] - MobilePhoneLocale(s) + * @param [options] - Options + */ +export function isMobilePhone( + str: string, + locale?: 'any' | MobilePhoneLocale | 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/). + */ +export function isMongoId(str: string): boolean; + +/** + * Check if the string contains one or more multibyte chars. + */ +export function isMultibyte(str: string): boolean; + +export interface IsNumericOptions { + /** + * If `no_symbols` is true, the validator will reject numeric strings that feature a symbol (e.g. `+`, `-`, or `.`). + * + * @default false + */ + no_symbols?: boolean; +} + +/** + * Check if the string contains only numbers. + * + * @param [options] - Options + */ +export function isNumeric(str: string, options?: IsNumericOptions): boolean; + +/** + * Check if the string is a valid octal number. + */ +export function isOctal(str: string): boolean; + +/** + * Check if the string is a valid port number. + */ +export function isPort(str: string): boolean; + +export type PostalCodeLocale = + | 'AD' + | 'AT' + | 'AU' + | 'BE' + | 'BG' + | 'BR' + | 'CA' + | 'CH' + | 'CZ' + | 'DE' + | 'DK' + | 'DZ' + | 'EE' + | 'ES' + | 'FI' + | 'FR' + | 'GB' + | 'GR' + | 'HR' + | 'HU' + | 'ID' + | 'IE' + | 'IL' + | 'IN' + | 'IS' + | 'IT' + | 'JP' + | 'KE' + | 'LI' + | 'LT' + | 'LU' + | 'LV' + | 'MX' + | 'MT' + | 'NL' + | 'NO' + | 'NZ' + | 'PL' + | 'PR' + | 'PT' + | 'RO' + | 'RU' + | 'SA' + | 'SE' + | 'SI' + | 'SK' + | 'TN' + | 'TW' + | 'UA' + | 'US' + | 'ZA' + | 'ZM'; + +export const isPostalCodeLocales: PostalCodeLocale[]; + +/** + * Check if the string is a postal code + * + * @param locale - PostalCodeLocale + */ +export function isPostalCode(str: string, locale: 'any' | PostalCodeLocale): boolean; + +/** + * Check if the string contains any surrogate pairs chars. + */ +export function isSurrogatePair(str: string): boolean; + +export interface IsURLOptions { + /** + * @default ['http','https','ftp'] + */ + protocols?: string[]; + /** + * @default true + */ + require_tld?: boolean; + /** + * @default false + */ + require_protocol?: boolean; + /** + * @default true + */ + require_host?: boolean; + /** + * @default true + */ + require_valid_protocol?: boolean; + /** + * @default false + */ + allow_underscores?: boolean; + /** + * @default false + */ + host_whitelist?: Array; + /** + * @default false + */ + host_blacklist?: Array; + /** + * @default false + */ + allow_trailing_dot?: boolean; + /** + * @default false + */ + allow_protocol_relative_urls?: boolean; + /** + * @default false + */ + disallow_auth?: boolean; +} + +/** + * Check if the string is an URL. + * + * @param [options] - Options + */ +export function isURL(str: string, options?: IsURLOptions): boolean; + +/** + * Check if the string is uppercase. + */ +export function isUppercase(str: string): boolean; + +/** + * Check if the string is a UUID (version 3, 4 or 5). + * + * @param [version="all"] - UUID version + */ +export function isUUID(str: string, version?: 3 | 4 | 5 | '3' | '4' | '5' | 'all'): boolean; + +/** + * Check if the string contains a mixture of full and half-width chars. + */ +export function isVariableWidth(str: string): boolean; + +/** + * Checks characters if they appear in the whitelist. + * + * @param chars - whitelist + */ +export function isWhitelisted(str: string, chars: string | string[]): boolean; + +/** + * Check if string matches the pattern. + * + * @param pattern - `/foo/i` + */ +export function matches(str: string, pattern: RegExp): boolean; +/** + * Check if string matches the pattern. + * + * @param pattern - `'foo'` + * @param [modifiers] - `'i'` + */ +export function matches(str: string, pattern: string, modifiers?: string): boolean; + +/** + * Check if the string is of type slug. + */ +export function isSlug(str: string): boolean; + +/****************** + *** Sanitizers *** + ******************/ + +/** + * Remove characters that appear in the blacklist. + * + * @param chars - The characters are used in a `RegExp` and so you will need to escape some chars, e.g. `blacklist(input, '\\[\\]')`. + */ +export function blacklist(input: string, chars: string): string; + +/** + * Replace `<`, `>`, `&`, `'`, `"` and `/` with HTML entities. + */ +export function escape(input: string): string; + +/** + * Replaces HTML encoded entities with `<`, `>`, `&`, `'`, `"` and `/`. + */ +export function unescape(input: string): string; + +/** + * Trim characters from the left-side of the input. + * + * @param [chars] - characters (defaults to whitespace) + */ +export function ltrim(input: string, chars?: string): string; + +export interface NormalizeEmailOptions { + /** + * Transforms the local part (before the @ symbol) of all email addresses to lowercase. + * Please note that this may violate RFC 5321, which gives providers the possibility + * to treat the local part of email addresses in a case sensitive way + * (although in practice most - yet not all - providers don't). + * The domain part of the email address is always lowercased, as it's case insensitive per RFC 1035. + * + * @default true + */ + all_lowercase?: boolean; + /** + * GMail addresses are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`. + * Please note that when `all_lowercase` is `true`, GMail addresses are lowercased regardless of the value of this setting. + * + * @default true + */ + gmail_lowercase?: boolean; + /** + * Removes dots from the local part of the email address, as GMail ignores them + * (e.g. `"john.doe"` and `"johndoe"` are considered equal). + * + * @default true + */ + gmail_remove_dots?: boolean; + /** + * Normalizes addresses by removing "sub-addresses", which is the part following a `"+"` sign + * (e.g. `"foo+bar@gmail.com"` becomes `"foo@gmail.com"`). + * + * @default true + */ + gmail_remove_subaddress?: boolean; + /** + * Converts addresses with domain `@googlemail.com` to `@gmail.com`, as they're equivalent. + * + * @default true + */ + gmail_convert_googlemaildotcom?: boolean; + /** + * Outlook.com addresses (including Windows Live and Hotmail) are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`. + * Please note that when `all_lowercase` is `true`, Outlook.com addresses are lowercased regardless of the value of this setting. + * + * @default true + */ + outlookdotcom_lowercase?: boolean; + /** + * Normalizes addresses by removing "sub-addresses", which is the part following a `"+"` sign + * (e.g. `"foo+bar@outlook.com"` becomes `"foo@outlook.com"`). + * + * @default true + */ + outlookdotcom_remove_subaddress?: boolean; + /** + * Yahoo Mail addresses are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`. + * Please note that when `all_lowercase` is `true`, Yahoo Mail addresses are lowercased regardless of the value of this setting. + * + * @default true + */ + yahoo_lowercase?: boolean; + /** + * Normalizes addresses by removing "sub-addresses", which is the part following a `"-"` sign + * (e.g. `"foo-bar@yahoo.com"` becomes `"foo@yahoo.com"`). + * + * @default true + */ + yahoo_remove_subaddress?: boolean; + /** + * iCloud addresses (including MobileMe) are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`. + * Please note that when `all_lowercase` is `true`, iCloud addresses are lowercased regardless of the value of this setting. + * + * @default true + */ + icloud_lowercase?: boolean; + /** + * Normalizes addresses by removing "sub-addresses", which is the part following a `"+"` sign + * (e.g. `"foo+bar@icloud.com"` becomes `"foo@icloud.com"`). + * + * @default true + */ + icloud_remove_subaddress?: boolean; +} + +/** + * Canonicalizes an email address. (This doesn't validate that the input is an email, if you want to validate the email use `isEmail` beforehand) + * + * @param [options] - Options + */ +export function normalizeEmail(email: string, options?: NormalizeEmailOptions): string | false; + +/** + * Trim characters from the right-side of the input. + * + * @param [chars] - characters (defaults to whitespace) + */ +export function rtrim(input: string, chars?: string): string; + +/** + * Remove characters with a numerical value < `32` and `127`, mostly control characters. + * Unicode-safe in JavaScript. + * + * @param [keep_new_lines=false] - if `true`, newline characters are preserved (`\n` and `\r`, hex `0xA` and `0xD`). + */ +export function stripLow(input: string, keep_new_lines?: boolean): string; + +/** + * Convert the input string to a boolean. + * Everything except for `'0'`, `'false'` and `''` returns `true`. + * + * @param [strict=false] - in `strict` mode, only `'1'` and `'true'` return `true`. + */ +export function toBoolean(input: string, strict?: boolean): boolean; + +/** + * Convert the input string to a `Date`, or `null` if the input is not a date. + */ +export function toDate(input: string): Date | null; + +/** + * Convert the input string to a float, or `NaN` if the input is not a float. + */ +export function toFloat(input: string): number; + +/** + * Convert the input string to an integer, or `NaN` if the input is not an integer. + * + * @param [radix=10] - radix or base (defaults to 10) + */ +export function toInt(input: string, radix?: number): number; + +/** + * Trim characters from both sides of the input. + * + * @param [chars] - characters (defaults to whitespace) + */ +export function trim(input: string, chars?: string): string; + +/** + * Remove characters that do not appear in the whitelist. + * + * @param chars - The characters are used in a `RegExp` and so you will need to escape some chars, e.g. `whitelist(input, '\\[\\]')`. + */ +export function whitelist(input: string, chars: string): string; + +/** + * Converts to string. + */ +export function toString(input: any): string; + +import * as Validator from './'; + +export default Validator; diff --git a/types/validator/lib/blacklist.d.ts b/types/validator/lib/blacklist.d.ts index 0378a25f3f..3cc0adfef1 100644 --- a/types/validator/lib/blacklist.d.ts +++ b/types/validator/lib/blacklist.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const blacklist: typeof validator.blacklist; -export = blacklist; \ No newline at end of file +export { blacklist as default } from '../'; diff --git a/types/validator/lib/contains.d.ts b/types/validator/lib/contains.d.ts index 2b2ae28e83..d1ab9cc3a5 100644 --- a/types/validator/lib/contains.d.ts +++ b/types/validator/lib/contains.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const contains: typeof validator.contains; -export = contains; \ No newline at end of file +export { contains as default } from '../'; diff --git a/types/validator/lib/equals.d.ts b/types/validator/lib/equals.d.ts index d6e7cfb20e..e006b81bfb 100644 --- a/types/validator/lib/equals.d.ts +++ b/types/validator/lib/equals.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const equals: typeof validator.equals; -export = equals; \ No newline at end of file +export { equals as default } from '../'; diff --git a/types/validator/lib/escape.d.ts b/types/validator/lib/escape.d.ts index fa50afd954..b61d3c60c4 100644 --- a/types/validator/lib/escape.d.ts +++ b/types/validator/lib/escape.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const escape: typeof validator.escape; -export = escape; \ No newline at end of file +export { escape as default } from '../'; diff --git a/types/validator/lib/isAfter.d.ts b/types/validator/lib/isAfter.d.ts index e8a4403da9..d37e6b01f0 100644 --- a/types/validator/lib/isAfter.d.ts +++ b/types/validator/lib/isAfter.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isAfter: typeof validator.isAfter; -export = isAfter; \ No newline at end of file +export { isAfter as default } from '../'; diff --git a/types/validator/lib/isAlpha.d.ts b/types/validator/lib/isAlpha.d.ts index 76d048c0ec..e68ad79aea 100644 --- a/types/validator/lib/isAlpha.d.ts +++ b/types/validator/lib/isAlpha.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isAlpha: typeof validator.isAlpha; -export = isAlpha; \ No newline at end of file +export { isAlpha as default } from '../'; diff --git a/types/validator/lib/isAlphanumeric.d.ts b/types/validator/lib/isAlphanumeric.d.ts index 2f08acf17e..f8abe69001 100644 --- a/types/validator/lib/isAlphanumeric.d.ts +++ b/types/validator/lib/isAlphanumeric.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isAlphanumeric: typeof validator.isAlphanumeric; -export = isAlphanumeric; \ No newline at end of file +export { isAlphanumeric as default } from '../'; diff --git a/types/validator/lib/isAscii.d.ts b/types/validator/lib/isAscii.d.ts index b50077709a..0bf986c021 100644 --- a/types/validator/lib/isAscii.d.ts +++ b/types/validator/lib/isAscii.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isAscii: typeof validator.isAscii; -export = isAscii; \ No newline at end of file +export { isAscii as default } from '../'; diff --git a/types/validator/lib/isBIC.d.ts b/types/validator/lib/isBIC.d.ts new file mode 100644 index 0000000000..77d1f57a25 --- /dev/null +++ b/types/validator/lib/isBIC.d.ts @@ -0,0 +1 @@ +export { isBIC as default } from '../'; diff --git a/types/validator/lib/isBase32.d.ts b/types/validator/lib/isBase32.d.ts new file mode 100644 index 0000000000..7665521e18 --- /dev/null +++ b/types/validator/lib/isBase32.d.ts @@ -0,0 +1 @@ +export { isBase32 as default } from '..'; diff --git a/types/validator/lib/isBase64.d.ts b/types/validator/lib/isBase64.d.ts index 9c25528106..a7776e6513 100644 --- a/types/validator/lib/isBase64.d.ts +++ b/types/validator/lib/isBase64.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isBase64: typeof validator.isBase64; -export = isBase64; \ No newline at end of file +export { isBase64 as default } from '../'; diff --git a/types/validator/lib/isBefore.d.ts b/types/validator/lib/isBefore.d.ts index 946eb25f1f..6651b9374d 100644 --- a/types/validator/lib/isBefore.d.ts +++ b/types/validator/lib/isBefore.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isBefore: typeof validator.isBefore; -export = isBefore; \ No newline at end of file +export { isBefore as default } from '../'; diff --git a/types/validator/lib/isBoolean.d.ts b/types/validator/lib/isBoolean.d.ts index df0bb00e2c..288dfa38fd 100644 --- a/types/validator/lib/isBoolean.d.ts +++ b/types/validator/lib/isBoolean.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isBoolean: typeof validator.isBoolean; -export = isBoolean; \ No newline at end of file +export { isBoolean as default } from '../'; diff --git a/types/validator/lib/isByteLength.d.ts b/types/validator/lib/isByteLength.d.ts index d4c0dd9de1..94fe49d740 100644 --- a/types/validator/lib/isByteLength.d.ts +++ b/types/validator/lib/isByteLength.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isByteLength: typeof validator.isByteLength; -export = isByteLength; \ No newline at end of file +export { isByteLength as default } from '../'; diff --git a/types/validator/lib/isCreditCard.d.ts b/types/validator/lib/isCreditCard.d.ts index 6fe82888b5..f1d9d9a1d4 100644 --- a/types/validator/lib/isCreditCard.d.ts +++ b/types/validator/lib/isCreditCard.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isCreditCard: typeof validator.isCreditCard; -export = isCreditCard; \ No newline at end of file +export { isCreditCard as default } from '../'; diff --git a/types/validator/lib/isCurrency.d.ts b/types/validator/lib/isCurrency.d.ts index 6a082d2fce..8fdc06ab68 100644 --- a/types/validator/lib/isCurrency.d.ts +++ b/types/validator/lib/isCurrency.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isCurrency: typeof validator.isCurrency; -export = isCurrency; \ No newline at end of file +export { isCurrency as default } from '../'; diff --git a/types/validator/lib/isDataURI.d.ts b/types/validator/lib/isDataURI.d.ts index 6de70d3e05..f8d28de424 100644 --- a/types/validator/lib/isDataURI.d.ts +++ b/types/validator/lib/isDataURI.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isDataURI: typeof validator.isDataURI; -export = isDataURI; \ No newline at end of file +export { isDataURI as default } from '../'; diff --git a/types/validator/lib/isDecimal.d.ts b/types/validator/lib/isDecimal.d.ts index cdf916ef92..2bceb5f4fa 100644 --- a/types/validator/lib/isDecimal.d.ts +++ b/types/validator/lib/isDecimal.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isDecimal: typeof validator.isDecimal; -export = isDecimal; \ No newline at end of file +export { isDecimal as default } from '../'; diff --git a/types/validator/lib/isDivisibleBy.d.ts b/types/validator/lib/isDivisibleBy.d.ts index 8dc99ccaff..816f4b23ae 100644 --- a/types/validator/lib/isDivisibleBy.d.ts +++ b/types/validator/lib/isDivisibleBy.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isDivisibleBy: typeof validator.isDivisibleBy; -export = isDivisibleBy; \ No newline at end of file +export { isDivisibleBy as default } from '../'; diff --git a/types/validator/lib/isEmail.d.ts b/types/validator/lib/isEmail.d.ts index 0e956cd418..1cd644e441 100644 --- a/types/validator/lib/isEmail.d.ts +++ b/types/validator/lib/isEmail.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isEmail: typeof validator.isEmail; -export = isEmail; \ No newline at end of file +export { isEmail as default } from '../'; diff --git a/types/validator/lib/isEmpty.d.ts b/types/validator/lib/isEmpty.d.ts index 2e05cc4c9c..b832cee101 100644 --- a/types/validator/lib/isEmpty.d.ts +++ b/types/validator/lib/isEmpty.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isEmpty: typeof validator.isEmpty; -export = isEmpty; \ No newline at end of file +export { isEmpty as default } from '../'; diff --git a/types/validator/lib/isFQDN.d.ts b/types/validator/lib/isFQDN.d.ts index 7e96e99006..0cbb640fad 100644 --- a/types/validator/lib/isFQDN.d.ts +++ b/types/validator/lib/isFQDN.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isFQDN: typeof validator.isFQDN; -export = isFQDN; \ No newline at end of file +export { isFQDN as default } from '../'; diff --git a/types/validator/lib/isFloat.d.ts b/types/validator/lib/isFloat.d.ts index 39dd0f3014..c270b1c501 100644 --- a/types/validator/lib/isFloat.d.ts +++ b/types/validator/lib/isFloat.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isFloat: typeof validator.isFloat; -export = isFloat; \ No newline at end of file +export { isFloat as default } from '../'; diff --git a/types/validator/lib/isFullWidth.d.ts b/types/validator/lib/isFullWidth.d.ts index 56c5c50897..f06115ab37 100644 --- a/types/validator/lib/isFullWidth.d.ts +++ b/types/validator/lib/isFullWidth.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isFullWidth: typeof validator.isFullWidth; -export = isFullWidth; \ No newline at end of file +export { isFullWidth as default } from '../'; diff --git a/types/validator/lib/isHalfWidth.d.ts b/types/validator/lib/isHalfWidth.d.ts index d67580b94c..978827f3bb 100644 --- a/types/validator/lib/isHalfWidth.d.ts +++ b/types/validator/lib/isHalfWidth.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isHalfWidth: typeof validator.isHalfWidth; -export = isHalfWidth; \ No newline at end of file +export { isHalfWidth as default } from '../'; diff --git a/types/validator/lib/isHash.d.ts b/types/validator/lib/isHash.d.ts index ddc534e45b..e009787a9e 100644 --- a/types/validator/lib/isHash.d.ts +++ b/types/validator/lib/isHash.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isHash: typeof validator.isHash; -export = isHash; \ No newline at end of file +export { isHash as default } from '../'; diff --git a/types/validator/lib/isHexColor.d.ts b/types/validator/lib/isHexColor.d.ts index 142678e436..bdd447b412 100644 --- a/types/validator/lib/isHexColor.d.ts +++ b/types/validator/lib/isHexColor.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isHexColor: typeof validator.isHexColor; -export = isHexColor; \ No newline at end of file +export { isHexColor as default } from '../'; diff --git a/types/validator/lib/isHexadecimal.d.ts b/types/validator/lib/isHexadecimal.d.ts index 4db0e8c058..e8c1c9b85e 100644 --- a/types/validator/lib/isHexadecimal.d.ts +++ b/types/validator/lib/isHexadecimal.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isHexadecimal: typeof validator.isHexadecimal; -export = isHexadecimal; \ No newline at end of file +export { isHexadecimal as default } from '../'; diff --git a/types/validator/lib/isIP.d.ts b/types/validator/lib/isIP.d.ts index f1e42f8571..06a1a3fefc 100644 --- a/types/validator/lib/isIP.d.ts +++ b/types/validator/lib/isIP.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isIP: typeof validator.isIP; -export = isIP; \ No newline at end of file +export { isIP as default } from '../'; diff --git a/types/validator/lib/isIPRange.d.ts b/types/validator/lib/isIPRange.d.ts new file mode 100644 index 0000000000..5e2180866d --- /dev/null +++ b/types/validator/lib/isIPRange.d.ts @@ -0,0 +1 @@ +export { isIPRange as default } from '..'; diff --git a/types/validator/lib/isISBN.d.ts b/types/validator/lib/isISBN.d.ts index f4b3870210..293e31b95e 100644 --- a/types/validator/lib/isISBN.d.ts +++ b/types/validator/lib/isISBN.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISBN: typeof validator.isISBN; -export = isISBN; \ No newline at end of file +export { isISBN as default } from '../'; diff --git a/types/validator/lib/isISIN.d.ts b/types/validator/lib/isISIN.d.ts index 97da3b3d9e..b3568a7054 100644 --- a/types/validator/lib/isISIN.d.ts +++ b/types/validator/lib/isISIN.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISIN: typeof validator.isISIN; -export = isISIN; \ No newline at end of file +export { isISIN as default } from '../'; diff --git a/types/validator/lib/isISO31661Alpha2.d.ts b/types/validator/lib/isISO31661Alpha2.d.ts index f9fcd72dc0..6d1742a3c5 100644 --- a/types/validator/lib/isISO31661Alpha2.d.ts +++ b/types/validator/lib/isISO31661Alpha2.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISO31661Alpha2: typeof validator.isISO31661Alpha2; -export = isISO31661Alpha2; \ No newline at end of file +export { isISO31661Alpha2 as default } from '../'; diff --git a/types/validator/lib/isISO31661Alpha3.d.ts b/types/validator/lib/isISO31661Alpha3.d.ts index b209642820..26a4d5179a 100644 --- a/types/validator/lib/isISO31661Alpha3.d.ts +++ b/types/validator/lib/isISO31661Alpha3.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISO31661Alpha3: typeof validator.isISO31661Alpha3; -export = isISO31661Alpha3; \ No newline at end of file +export { isISO31661Alpha3 as default } from '../'; diff --git a/types/validator/lib/isISO8601.d.ts b/types/validator/lib/isISO8601.d.ts index 353e4398b2..119706c4ad 100644 --- a/types/validator/lib/isISO8601.d.ts +++ b/types/validator/lib/isISO8601.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISO8601: typeof validator.isISO8601; -export = isISO8601; \ No newline at end of file +export { isISO8601 as default } from '../'; diff --git a/types/validator/lib/isISRC.d.ts b/types/validator/lib/isISRC.d.ts index 5682f56d73..32258853d2 100644 --- a/types/validator/lib/isISRC.d.ts +++ b/types/validator/lib/isISRC.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISRC: typeof validator.isISRC; -export = isISRC; \ No newline at end of file +export { isISRC as default } from '../'; diff --git a/types/validator/lib/isISSN.d.ts b/types/validator/lib/isISSN.d.ts index 991d62d4b4..cd3b5cef71 100644 --- a/types/validator/lib/isISSN.d.ts +++ b/types/validator/lib/isISSN.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isISSN: typeof validator.isISSN; -export = isISSN; \ No newline at end of file +export { isISSN as default } from '../'; diff --git a/types/validator/lib/isIdentityCard.d.ts b/types/validator/lib/isIdentityCard.d.ts new file mode 100644 index 0000000000..2223b2f550 --- /dev/null +++ b/types/validator/lib/isIdentityCard.d.ts @@ -0,0 +1 @@ +export { isIdentityCard as default } from '..'; diff --git a/types/validator/lib/isIn.d.ts b/types/validator/lib/isIn.d.ts index 31f7560062..531b235bee 100644 --- a/types/validator/lib/isIn.d.ts +++ b/types/validator/lib/isIn.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isIn: typeof validator.isIn; -export = isIn; \ No newline at end of file +export { isIn as default } from '../'; diff --git a/types/validator/lib/isInt.d.ts b/types/validator/lib/isInt.d.ts index 57c2f56425..c8dd30875c 100644 --- a/types/validator/lib/isInt.d.ts +++ b/types/validator/lib/isInt.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isInt: typeof validator.isInt; -export = isInt; \ No newline at end of file +export { isInt as default } from '../'; diff --git a/types/validator/lib/isJSON.d.ts b/types/validator/lib/isJSON.d.ts index f65967a0fa..bae29c4568 100644 --- a/types/validator/lib/isJSON.d.ts +++ b/types/validator/lib/isJSON.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isJSON: typeof validator.isJSON; -export = isJSON; \ No newline at end of file +export { isJSON as default } from '../'; diff --git a/types/validator/lib/isJWT.d.ts b/types/validator/lib/isJWT.d.ts index dcf78bbfa2..b60b689eed 100644 --- a/types/validator/lib/isJWT.d.ts +++ b/types/validator/lib/isJWT.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isJWT: typeof validator.isJWT; -export = isJWT; \ No newline at end of file +export { isJWT as default } from '../'; diff --git a/types/validator/lib/isLatLong.d.ts b/types/validator/lib/isLatLong.d.ts index 301601b05c..7c9877d835 100644 --- a/types/validator/lib/isLatLong.d.ts +++ b/types/validator/lib/isLatLong.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isLatLong: typeof validator.isLatLong; -export = isLatLong; \ No newline at end of file +export { isLatLong as default } from '../'; diff --git a/types/validator/lib/isLength.d.ts b/types/validator/lib/isLength.d.ts index a98a0923bc..fa3b00f4f5 100644 --- a/types/validator/lib/isLength.d.ts +++ b/types/validator/lib/isLength.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isLength: typeof validator.isLength; -export = isLength; \ No newline at end of file +export { isLength as default } from '../'; diff --git a/types/validator/lib/isLowercase.d.ts b/types/validator/lib/isLowercase.d.ts index ef80f06795..9d4c750fc7 100644 --- a/types/validator/lib/isLowercase.d.ts +++ b/types/validator/lib/isLowercase.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isLowercase: typeof validator.isLowercase; -export = isLowercase; \ No newline at end of file +export { isLowercase as default } from '../'; diff --git a/types/validator/lib/isMACAddress.d.ts b/types/validator/lib/isMACAddress.d.ts index 1be3635854..82ece59cbd 100644 --- a/types/validator/lib/isMACAddress.d.ts +++ b/types/validator/lib/isMACAddress.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMACAddress: typeof validator.isMACAddress; -export = isMACAddress; \ No newline at end of file +export { isMACAddress as default } from '../'; diff --git a/types/validator/lib/isMD5.d.ts b/types/validator/lib/isMD5.d.ts index 42d12c2f31..11d78b4454 100644 --- a/types/validator/lib/isMD5.d.ts +++ b/types/validator/lib/isMD5.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMD5: typeof validator.isMD5; -export = isMD5; \ No newline at end of file +export { isMD5 as default } from '../'; diff --git a/types/validator/lib/isMagnetURI.d.ts b/types/validator/lib/isMagnetURI.d.ts new file mode 100644 index 0000000000..de5b735afa --- /dev/null +++ b/types/validator/lib/isMagnetURI.d.ts @@ -0,0 +1 @@ +export { isMagnetURI as default } from '..'; diff --git a/types/validator/lib/isMimeType.d.ts b/types/validator/lib/isMimeType.d.ts index f2b5fe7c9f..ae93d1d5e3 100644 --- a/types/validator/lib/isMimeType.d.ts +++ b/types/validator/lib/isMimeType.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMimeType: typeof validator.isMimeType; -export = isMimeType; \ No newline at end of file +export { isMimeType as default } from '../'; diff --git a/types/validator/lib/isMobilePhone.d.ts b/types/validator/lib/isMobilePhone.d.ts index e56d296860..6fdc6dfb85 100644 --- a/types/validator/lib/isMobilePhone.d.ts +++ b/types/validator/lib/isMobilePhone.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMobilePhone: typeof validator.isMobilePhone; -export = isMobilePhone; \ No newline at end of file +export { isMobilePhone as default } from '../'; diff --git a/types/validator/lib/isMongoId.d.ts b/types/validator/lib/isMongoId.d.ts index 4b4a6f3f64..cf542fa8bb 100644 --- a/types/validator/lib/isMongoId.d.ts +++ b/types/validator/lib/isMongoId.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMongoId: typeof validator.isMongoId; -export = isMongoId; \ No newline at end of file +export { isMongoId as default } from '../'; diff --git a/types/validator/lib/isMultibyte.d.ts b/types/validator/lib/isMultibyte.d.ts index 0663d86efc..502d176926 100644 --- a/types/validator/lib/isMultibyte.d.ts +++ b/types/validator/lib/isMultibyte.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isMultibyte: typeof validator.isMultibyte; -export = isMultibyte; \ No newline at end of file +export { isMultibyte as default } from '../'; diff --git a/types/validator/lib/isNumeric.d.ts b/types/validator/lib/isNumeric.d.ts index ca77c0c040..c9c6ea822b 100644 --- a/types/validator/lib/isNumeric.d.ts +++ b/types/validator/lib/isNumeric.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isNumeric: typeof validator.isNumeric; -export = isNumeric; \ No newline at end of file +export { isNumeric as default } from '../'; diff --git a/types/validator/lib/isOctal.d.ts b/types/validator/lib/isOctal.d.ts new file mode 100644 index 0000000000..c3f4f7d315 --- /dev/null +++ b/types/validator/lib/isOctal.d.ts @@ -0,0 +1 @@ +export { isOctal as default } from '..'; diff --git a/types/validator/lib/isPort.d.ts b/types/validator/lib/isPort.d.ts index 9abfe0e7eb..49880f81ab 100644 --- a/types/validator/lib/isPort.d.ts +++ b/types/validator/lib/isPort.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isPort: typeof validator.isPort; -export = isPort; \ No newline at end of file +export { isPort as default } from '../'; diff --git a/types/validator/lib/isPostalCode.d.ts b/types/validator/lib/isPostalCode.d.ts index 389cc6bc7a..5714e695e6 100644 --- a/types/validator/lib/isPostalCode.d.ts +++ b/types/validator/lib/isPostalCode.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isPostalCode: typeof validator.isPostalCode; -export = isPostalCode; \ No newline at end of file +export { isPostalCode as default } from '../'; diff --git a/types/validator/lib/isRFC3339.d.ts b/types/validator/lib/isRFC3339.d.ts new file mode 100644 index 0000000000..5f31fe91b6 --- /dev/null +++ b/types/validator/lib/isRFC3339.d.ts @@ -0,0 +1 @@ +export { isRFC3339 as default } from '../'; diff --git a/types/validator/lib/isSlug.d.ts b/types/validator/lib/isSlug.d.ts new file mode 100644 index 0000000000..7e0cd02ee3 --- /dev/null +++ b/types/validator/lib/isSlug.d.ts @@ -0,0 +1 @@ +export { isSlug as default } from '..'; diff --git a/types/validator/lib/isSurrogatePair.d.ts b/types/validator/lib/isSurrogatePair.d.ts index ad093ea8d0..f790b3eb77 100644 --- a/types/validator/lib/isSurrogatePair.d.ts +++ b/types/validator/lib/isSurrogatePair.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isSurrogatePair: typeof validator.isSurrogatePair; -export = isSurrogatePair; \ No newline at end of file +export { isSurrogatePair as default } from '../'; diff --git a/types/validator/lib/isURL.d.ts b/types/validator/lib/isURL.d.ts index 06d0476922..622bb5bb19 100644 --- a/types/validator/lib/isURL.d.ts +++ b/types/validator/lib/isURL.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isURL: typeof validator.isURL; -export = isURL; \ No newline at end of file +export { isURL as default } from '../'; diff --git a/types/validator/lib/isUUID.d.ts b/types/validator/lib/isUUID.d.ts index a112323c7f..2043ee1451 100644 --- a/types/validator/lib/isUUID.d.ts +++ b/types/validator/lib/isUUID.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isUUID: typeof validator.isUUID; -export = isUUID; \ No newline at end of file +export { isUUID as default } from '../'; diff --git a/types/validator/lib/isUppercase.d.ts b/types/validator/lib/isUppercase.d.ts index 88d478f32c..771b79962f 100644 --- a/types/validator/lib/isUppercase.d.ts +++ b/types/validator/lib/isUppercase.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isUppercase: typeof validator.isUppercase; -export = isUppercase; \ No newline at end of file +export { isUppercase as default } from '../'; diff --git a/types/validator/lib/isVariableWidth.d.ts b/types/validator/lib/isVariableWidth.d.ts index ab444a38c8..36f3fb3bcb 100644 --- a/types/validator/lib/isVariableWidth.d.ts +++ b/types/validator/lib/isVariableWidth.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isVariableWidth: typeof validator.isVariableWidth; -export = isVariableWidth; \ No newline at end of file +export { isVariableWidth as default } from '../'; diff --git a/types/validator/lib/isWhitelisted.d.ts b/types/validator/lib/isWhitelisted.d.ts index 852c87e56f..d0f7767169 100644 --- a/types/validator/lib/isWhitelisted.d.ts +++ b/types/validator/lib/isWhitelisted.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const isWhitelisted: typeof validator.isWhitelisted; -export = isWhitelisted; \ No newline at end of file +export { isWhitelisted as default } from '../'; diff --git a/types/validator/lib/ltrim.d.ts b/types/validator/lib/ltrim.d.ts index 15e4715525..c15b010bc1 100644 --- a/types/validator/lib/ltrim.d.ts +++ b/types/validator/lib/ltrim.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const ltrim: typeof validator.ltrim; -export = ltrim; \ No newline at end of file +export { ltrim as default } from '../'; diff --git a/types/validator/lib/matches.d.ts b/types/validator/lib/matches.d.ts index 97f4f1cd1a..0610e55f53 100644 --- a/types/validator/lib/matches.d.ts +++ b/types/validator/lib/matches.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const matches: typeof validator.matches; -export = matches; \ No newline at end of file +export { matches as default } from '../'; diff --git a/types/validator/lib/normalizeEmail.d.ts b/types/validator/lib/normalizeEmail.d.ts index 5cadf5531e..c5f041d0d0 100644 --- a/types/validator/lib/normalizeEmail.d.ts +++ b/types/validator/lib/normalizeEmail.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const normalizeEmail: typeof validator.normalizeEmail; -export = normalizeEmail; \ No newline at end of file +export { normalizeEmail as default } from '../'; diff --git a/types/validator/lib/rtrim.d.ts b/types/validator/lib/rtrim.d.ts index 272f8c4d3c..2eb3518c67 100644 --- a/types/validator/lib/rtrim.d.ts +++ b/types/validator/lib/rtrim.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const rtrim: typeof validator.rtrim; -export = rtrim; \ No newline at end of file +export { rtrim as default } from '../'; diff --git a/types/validator/lib/stripLow.d.ts b/types/validator/lib/stripLow.d.ts index 5d9ead0d8e..86ac4bd33e 100644 --- a/types/validator/lib/stripLow.d.ts +++ b/types/validator/lib/stripLow.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const stripLow: typeof validator.stripLow; -export = stripLow; \ No newline at end of file +export { stripLow as default } from '../'; diff --git a/types/validator/lib/toBoolean.d.ts b/types/validator/lib/toBoolean.d.ts index 1a186ce27c..e32f5d928b 100644 --- a/types/validator/lib/toBoolean.d.ts +++ b/types/validator/lib/toBoolean.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const toBoolean: typeof validator.toBoolean; -export = toBoolean; \ No newline at end of file +export { toBoolean as default } from '../'; diff --git a/types/validator/lib/toDate.d.ts b/types/validator/lib/toDate.d.ts index 01417d2fd7..6d4f3a45ce 100644 --- a/types/validator/lib/toDate.d.ts +++ b/types/validator/lib/toDate.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const toDate: typeof validator.toDate; -export = toDate; \ No newline at end of file +export { toDate as default } from '../'; diff --git a/types/validator/lib/toFloat.d.ts b/types/validator/lib/toFloat.d.ts index f08e200415..2da4cf1c6e 100644 --- a/types/validator/lib/toFloat.d.ts +++ b/types/validator/lib/toFloat.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const toFloat: typeof validator.toFloat; -export = toFloat; \ No newline at end of file +export { toFloat as default } from '../'; diff --git a/types/validator/lib/toInt.d.ts b/types/validator/lib/toInt.d.ts index 179e872e4b..d2a10712e7 100644 --- a/types/validator/lib/toInt.d.ts +++ b/types/validator/lib/toInt.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const toInt: typeof validator.toInt; -export = toInt; \ No newline at end of file +export { toInt as default } from '../'; diff --git a/types/validator/lib/trim.d.ts b/types/validator/lib/trim.d.ts index 8717b26559..2c7bcc827e 100644 --- a/types/validator/lib/trim.d.ts +++ b/types/validator/lib/trim.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const trim: typeof validator.trim; -export = trim; \ No newline at end of file +export { trim as default } from '../'; diff --git a/types/validator/lib/unescape.d.ts b/types/validator/lib/unescape.d.ts index e68b4b9d0a..af5b71aa2e 100644 --- a/types/validator/lib/unescape.d.ts +++ b/types/validator/lib/unescape.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const unescape: typeof validator.unescape; -export = unescape; \ No newline at end of file +export { unescape as default } from '../'; diff --git a/types/validator/lib/whitelist.d.ts b/types/validator/lib/whitelist.d.ts index 5f9fde6aec..ed23e85aad 100644 --- a/types/validator/lib/whitelist.d.ts +++ b/types/validator/lib/whitelist.d.ts @@ -1,3 +1 @@ -import * as validator from "validator"; -declare const whitelist: typeof validator.whitelist; -export = whitelist; \ No newline at end of file +export { whitelist as default } from '../'; diff --git a/types/validator/tsconfig.json b/types/validator/tsconfig.json index c50e120dc2..ef59f0c926 100644 --- a/types/validator/tsconfig.json +++ b/types/validator/tsconfig.json @@ -2,14 +2,14 @@ "compilerOptions": { "module": "commonjs", "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": ["../"], "types": [], "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, "forceConsistentCasingInFileNames": true }, "files": [ @@ -23,8 +23,10 @@ "lib/isAlpha.d.ts", "lib/isAlphanumeric.d.ts", "lib/isAscii.d.ts", + "lib/isBase32.d.ts", "lib/isBase64.d.ts", "lib/isBefore.d.ts", + "lib/isBIC.d.ts", "lib/isBoolean.d.ts", "lib/isByteLength.d.ts", "lib/isCreditCard.d.ts", @@ -34,41 +36,47 @@ "lib/isDivisibleBy.d.ts", "lib/isEmail.d.ts", "lib/isEmpty.d.ts", - "lib/isFQDN.d.ts", "lib/isFloat.d.ts", + "lib/isFQDN.d.ts", "lib/isFullWidth.d.ts", "lib/isHalfWidth.d.ts", "lib/isHash.d.ts", - "lib/isHexColor.d.ts", "lib/isHexadecimal.d.ts", + "lib/isHexColor.d.ts", + "lib/isIdentityCard.d.ts", + "lib/isIn.d.ts", + "lib/isInt.d.ts", "lib/isIP.d.ts", + "lib/isIPRange.d.ts", "lib/isISBN.d.ts", - "lib/isISSN.d.ts", "lib/isISIN.d.ts", "lib/isISO8601.d.ts", "lib/isISO31661Alpha2.d.ts", "lib/isISO31661Alpha3.d.ts", "lib/isISRC.d.ts", - "lib/isIn.d.ts", - "lib/isInt.d.ts", + "lib/isISSN.d.ts", "lib/isJSON.d.ts", "lib/isJWT.d.ts", "lib/isLatLong.d.ts", "lib/isLength.d.ts", "lib/isLowercase.d.ts", "lib/isMACAddress.d.ts", + "lib/isMagnetURI.d.ts", "lib/isMD5.d.ts", "lib/isMimeType.d.ts", "lib/isMobilePhone.d.ts", - "lib/isPostalCode.d.ts", "lib/isMongoId.d.ts", "lib/isMultibyte.d.ts", "lib/isNumeric.d.ts", + "lib/isOctal.d.ts", "lib/isPort.d.ts", + "lib/isPostalCode.d.ts", + "lib/isRFC3339.d.ts", + "lib/isSlug.d.ts", "lib/isSurrogatePair.d.ts", + "lib/isUppercase.d.ts", "lib/isURL.d.ts", "lib/isUUID.d.ts", - "lib/isUppercase.d.ts", "lib/isVariableWidth.d.ts", "lib/isWhitelisted.d.ts", "lib/ltrim.d.ts", diff --git a/types/validator/tslint.json b/types/validator/tslint.json index 3d59f55fda..f93cf8562a 100644 --- a/types/validator/tslint.json +++ b/types/validator/tslint.json @@ -1,80 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "npm-naming": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 526d8917cb..eede86ec73 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -1,645 +1,641 @@ import * as validator from 'validator'; /************************************************ -* * -* IMPORT TESTS * -* * -************************************************/ -import blacklistFunc = require('validator/lib/blacklist'); -import containsFunc = require('validator/lib/contains'); -import equalsFunc = require('validator/lib/equals'); -import escapeFunc = require('validator/lib/escape'); -import isAfterFunc = require('validator/lib/isAfter'); -import isAlphaFunc = require('validator/lib/isAlpha'); -import isAlphanumericFunc = require('validator/lib/isAlphanumeric'); -import isAsciiFunc = require('validator/lib/isAscii'); -import isBase64Func = require('validator/lib/isBase64'); -import isBeforeFunc = require('validator/lib/isBefore'); -import isBooleanFunc = require('validator/lib/isBoolean'); -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 isDecimalFunc = require('validator/lib/isDecimal'); -import isDivisibleByFunc = require('validator/lib/isDivisibleBy'); -import isEmailFunc = require('validator/lib/isEmail'); -import isEmptyFunc = require('validator/lib/isEmpty'); -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 isISO31661Alpha3Func = require('validator/lib/isISO31661Alpha3'); -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 isJWTFunc = require('validator/lib/isJWT'); -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 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'); -import isUUIDFunc = require('validator/lib/isUUID'); -import isUppercaseFunc = require('validator/lib/isUppercase'); -import isVariableWidthFunc = require('validator/lib/isVariableWidth'); -import isWhitelistedFunc = require('validator/lib/isWhitelisted'); -import ltrimFunc = require('validator/lib/ltrim'); -import matchesFunc = require('validator/lib/matches'); -import normalizeEmailFunc = require('validator/lib/normalizeEmail'); -import rtrimFunc = require('validator/lib/rtrim'); -import stripLowFunc = require('validator/lib/stripLow'); -import toBooleanFunc = require('validator/lib/toBoolean'); -import toDateFunc = require('validator/lib/toDate'); -import toFloatFunc = require('validator/lib/toFloat'); -import toIntFunc = require('validator/lib/toInt'); -import trimFunc = require('validator/lib/trim'); -import unescapeFunc = require('validator/lib/unescape'); -import whitelistFunc = require('validator/lib/whitelist'); + * * + * IMPORT TESTS * + * * + ************************************************/ +import blacklistFunc from 'validator/lib/blacklist'; +import containsFunc from 'validator/lib/contains'; +import equalsFunc from 'validator/lib/equals'; +import escapeFunc from 'validator/lib/escape'; +import isAfterFunc from 'validator/lib/isAfter'; +import isAlphaFunc from 'validator/lib/isAlpha'; +import isAlphanumericFunc from 'validator/lib/isAlphanumeric'; +import isAsciiFunc from 'validator/lib/isAscii'; +import isBase64Func from 'validator/lib/isBase64'; +import isBeforeFunc from 'validator/lib/isBefore'; +import isBooleanFunc from 'validator/lib/isBoolean'; +import isByteLengthFunc from 'validator/lib/isByteLength'; +import isCreditCardFunc from 'validator/lib/isCreditCard'; +import isCurrencyFunc from 'validator/lib/isCurrency'; +import isDataURIFunc from 'validator/lib/isDataURI'; +import isDecimalFunc from 'validator/lib/isDecimal'; +import isDivisibleByFunc from 'validator/lib/isDivisibleBy'; +import isEmailFunc from 'validator/lib/isEmail'; +import isEmptyFunc from 'validator/lib/isEmpty'; +import isFQDNFunc from 'validator/lib/isFQDN'; +import isFloatFunc from 'validator/lib/isFloat'; +import isFullWidthFunc from 'validator/lib/isFullWidth'; +import isHalfWidthFunc from 'validator/lib/isHalfWidth'; +import isHashFunc from 'validator/lib/isHash'; +import isHexColorFunc from 'validator/lib/isHexColor'; +import isHexadecimalFunc from 'validator/lib/isHexadecimal'; +import isIPFunc from 'validator/lib/isIP'; +import isISBNFunc from 'validator/lib/isISBN'; +import isISSNFunc from 'validator/lib/isISSN'; +import isISINFunc from 'validator/lib/isISIN'; +import isISO8601Func from 'validator/lib/isISO8601'; +import isISO31661Alpha2Func from 'validator/lib/isISO31661Alpha2'; +import isISO31661Alpha3Func from 'validator/lib/isISO31661Alpha3'; +import isISRCFunc from 'validator/lib/isISRC'; +import isInFunc from 'validator/lib/isIn'; +import isIntFunc from 'validator/lib/isInt'; +import isJSONFunc from 'validator/lib/isJSON'; +import isJWTFunc from 'validator/lib/isJWT'; +import isLatLongFunc from 'validator/lib/isLatLong'; +import isLengthFunc from 'validator/lib/isLength'; +import isLowercaseFunc from 'validator/lib/isLowercase'; +import isMACAddressFunc from 'validator/lib/isMACAddress'; +import isMD5Func from 'validator/lib/isMD5'; +import isMimeTypeFunc from 'validator/lib/isMimeType'; +import isMobilePhoneFunc from 'validator/lib/isMobilePhone'; +import isMongoIdFunc from 'validator/lib/isMongoId'; +import isMultibyteFunc from 'validator/lib/isMultibyte'; +import isNumericFunc from 'validator/lib/isNumeric'; +import isPortFunc from 'validator/lib/isPort'; +import isPostalCodeFunc from 'validator/lib/isPostalCode'; +import isSurrogatePairFunc from 'validator/lib/isSurrogatePair'; +import isURLFunc from 'validator/lib/isURL'; +import isUUIDFunc from 'validator/lib/isUUID'; +import isUppercaseFunc from 'validator/lib/isUppercase'; +import isVariableWidthFunc from 'validator/lib/isVariableWidth'; +import isWhitelistedFunc from 'validator/lib/isWhitelisted'; +import ltrimFunc from 'validator/lib/ltrim'; +import matchesFunc from 'validator/lib/matches'; +import normalizeEmailFunc from 'validator/lib/normalizeEmail'; +import rtrimFunc from 'validator/lib/rtrim'; +import stripLowFunc from 'validator/lib/stripLow'; +import toBooleanFunc from 'validator/lib/toBoolean'; +import toDateFunc from 'validator/lib/toDate'; +import toFloatFunc from 'validator/lib/toFloat'; +import toIntFunc from 'validator/lib/toInt'; +import trimFunc from 'validator/lib/trim'; +import unescapeFunc from 'validator/lib/unescape'; +import whitelistFunc from 'validator/lib/whitelist'; { - let _blacklist = validator.blacklist; - _blacklist = blacklistFunc; + let _blacklist = validator.blacklist; + _blacklist = blacklistFunc; - let _contains = validator.contains; - _contains = containsFunc; + let _contains = validator.contains; + _contains = containsFunc; - let _equals = validator.equals; - _equals = equalsFunc; + let _equals = validator.equals; + _equals = equalsFunc; - let _escape = validator.escape; - _escape = escapeFunc; + let _escape = validator.escape; + _escape = escapeFunc; - let _isAfter = validator.isAfter; - _isAfter = isAfterFunc; + let _isAfter = validator.isAfter; + _isAfter = isAfterFunc; - let _isAlpha = validator.isAlpha; - _isAlpha = isAlphaFunc; + let _isAlpha = validator.isAlpha; + _isAlpha = isAlphaFunc; - let _isAlphanumeric = validator.isAlphanumeric; - _isAlphanumeric = isAlphanumericFunc; + let _isAlphanumeric = validator.isAlphanumeric; + _isAlphanumeric = isAlphanumericFunc; - let _isAscii = validator.isAscii; - _isAscii = isAsciiFunc; + let _isAscii = validator.isAscii; + _isAscii = isAsciiFunc; - let _isBase64 = validator.isBase64; - _isBase64 = isBase64Func; + let _isBase64 = validator.isBase64; + _isBase64 = isBase64Func; - let _isBefore = validator.isBefore; - _isBefore = isBeforeFunc; + let _isBefore = validator.isBefore; + _isBefore = isBeforeFunc; - let _isBoolean = validator.isBoolean; - _isBoolean = isBooleanFunc; + let _isBoolean = validator.isBoolean; + _isBoolean = isBooleanFunc; - let _isByteLength = validator.isByteLength; - _isByteLength = isByteLengthFunc; + let _isByteLength = validator.isByteLength; + _isByteLength = isByteLengthFunc; - let _isCreditCard = validator.isCreditCard; - _isCreditCard = isCreditCardFunc; + let _isCreditCard = validator.isCreditCard; + _isCreditCard = isCreditCardFunc; - let _isCurrency = validator.isCurrency; - _isCurrency = isCurrencyFunc; + let _isCurrency = validator.isCurrency; + _isCurrency = isCurrencyFunc; - let _isDataURI = validator.isDataURI; - _isDataURI = isDataURIFunc; + let _isDataURI = validator.isDataURI; + _isDataURI = isDataURIFunc; - let _isDecimal = validator.isDecimal; - _isDecimal = isDecimalFunc; + let _isDecimal = validator.isDecimal; + _isDecimal = isDecimalFunc; - let _isDivisibleBy = validator.isDivisibleBy; - _isDivisibleBy = isDivisibleByFunc; + let _isDivisibleBy = validator.isDivisibleBy; + _isDivisibleBy = isDivisibleByFunc; - let _isEmail = validator.isEmail; - _isEmail = isEmailFunc; + let _isEmail = validator.isEmail; + _isEmail = isEmailFunc; - let _isEmpty = validator.isEmpty; - _isEmpty = isEmptyFunc; + let _isEmpty = validator.isEmpty; + _isEmpty = isEmptyFunc; - let _isFQDN = validator.isFQDN; - _isFQDN = isFQDNFunc; + let _isFQDN = validator.isFQDN; + _isFQDN = isFQDNFunc; - let _isFloat = validator.isFloat; - _isFloat = isFloatFunc; + let _isFloat = validator.isFloat; + _isFloat = isFloatFunc; - let _isFullWidth = validator.isFullWidth; - _isFullWidth = isFullWidthFunc; + let _isFullWidth = validator.isFullWidth; + _isFullWidth = isFullWidthFunc; - let _isHalfWidth = validator.isHalfWidth; - _isHalfWidth = isHalfWidthFunc; + let _isHalfWidth = validator.isHalfWidth; + _isHalfWidth = isHalfWidthFunc; - let _isHash = validator.isHash; - _isHash = isHashFunc; + let _isHash = validator.isHash; + _isHash = isHashFunc; - let _isHexColor = validator.isHexColor; - _isHexColor = isHexColorFunc; + let _isHexColor = validator.isHexColor; + _isHexColor = isHexColorFunc; - let _isHexadecimal = validator.isHexadecimal; - _isHexadecimal = isHexadecimalFunc; + let _isHexadecimal = validator.isHexadecimal; + _isHexadecimal = isHexadecimalFunc; - let _isIP = validator.isIP; - _isIP = isIPFunc; + let _isIP = validator.isIP; + _isIP = isIPFunc; - let _isISBN = validator.isISBN; - _isISBN = isISBNFunc; + let _isISBN = validator.isISBN; + _isISBN = isISBNFunc; - let _isISSN = validator.isISSN; - _isISSN = isISSNFunc; + let _isISSN = validator.isISSN; + _isISSN = isISSNFunc; - let _isISIN = validator.isISIN; - _isISIN = isISINFunc; + let _isISIN = validator.isISIN; + _isISIN = isISINFunc; - let _isISO8601 = validator.isISO8601; - _isISO8601 = isISO8601Func; + let _isISO8601 = validator.isISO8601; + _isISO8601 = isISO8601Func; - let _isISO31661Alpha2 = validator.isISO31661Alpha2; - _isISO31661Alpha2 = isISO31661Alpha2Func; + let _isISO31661Alpha2 = validator.isISO31661Alpha2; + _isISO31661Alpha2 = isISO31661Alpha2Func; - let _isISO31661Alpha3 = validator.isISO31661Alpha3; - _isISO31661Alpha3 = isISO31661Alpha3Func; + let _isISO31661Alpha3 = validator.isISO31661Alpha3; + _isISO31661Alpha3 = isISO31661Alpha3Func; - let _isISRC = validator.isISRC; - _isISRC = isISRCFunc; + let _isISRC = validator.isISRC; + _isISRC = isISRCFunc; - let _isIn = validator.isIn; - _isIn = isInFunc; + let _isIn = validator.isIn; + _isIn = isInFunc; - let _isInt = validator.isInt; - _isInt = isIntFunc; + let _isInt = validator.isInt; + _isInt = isIntFunc; - let _isJSON = validator.isJSON; - _isJSON = isJSONFunc; + let _isJSON = validator.isJSON; + _isJSON = isJSONFunc; - let _isJWT = validator.isJWT; - _isJWT = isJWTFunc; + let _isJWT = validator.isJWT; + _isJWT = isJWTFunc; - let _isLatLong = validator.isLatLong; - _isLatLong = isLatLongFunc; + let _isLatLong = validator.isLatLong; + _isLatLong = isLatLongFunc; - let _isLength = validator.isLength; - _isLength = isLengthFunc; + let _isLength = validator.isLength; + _isLength = isLengthFunc; - let _isLowercase = validator.isLowercase; - _isLowercase = isLowercaseFunc; + let _isLowercase = validator.isLowercase; + _isLowercase = isLowercaseFunc; - let _isMACAddress = validator.isMACAddress; - _isMACAddress = isMACAddressFunc; + let _isMACAddress = validator.isMACAddress; + _isMACAddress = isMACAddressFunc; - let _isMD5 = validator.isMD5; - _isMD5 = isMD5Func; + let _isMD5 = validator.isMD5; + _isMD5 = isMD5Func; - let _isMimeType = validator.isMimeType; - _isMimeType = isMimeTypeFunc; + let _isMimeType = validator.isMimeType; + _isMimeType = isMimeTypeFunc; - let _isMobilePhone = validator.isMobilePhone; - _isMobilePhone = isMobilePhoneFunc; + let _isMobilePhone = validator.isMobilePhone; + _isMobilePhone = isMobilePhoneFunc; - let _isMongoId = validator.isMongoId; - _isMongoId = isMongoIdFunc; + let _isMongoId = validator.isMongoId; + _isMongoId = isMongoIdFunc; - let _isMultibyte = validator.isMultibyte; - _isMultibyte = isMultibyteFunc; + let _isMultibyte = validator.isMultibyte; + _isMultibyte = isMultibyteFunc; - let _isNumeric = validator.isNumeric; - _isNumeric = isNumericFunc; + let _isNumeric = validator.isNumeric; + _isNumeric = isNumericFunc; - let _isPort = validator.isPort; - _isPort = isPortFunc; + let _isPort = validator.isPort; + _isPort = isPortFunc; - let _isPostalCode = validator.isPostalCode; - _isPostalCode = isPostalCodeFunc; + let _isPostalCode = validator.isPostalCode; + _isPostalCode = isPostalCodeFunc; - let _isSurrogatePair = validator.isSurrogatePair; - _isSurrogatePair = isSurrogatePairFunc; + let _isSurrogatePair = validator.isSurrogatePair; + _isSurrogatePair = isSurrogatePairFunc; - let _isURL = validator.isURL; - _isURL = isURLFunc; + let _isURL = validator.isURL; + _isURL = isURLFunc; - let _isUUID = validator.isUUID; - _isUUID = isUUIDFunc; + let _isUUID = validator.isUUID; + _isUUID = isUUIDFunc; - let _isUppercase = validator.isUppercase; - _isUppercase = isUppercaseFunc; + let _isUppercase = validator.isUppercase; + _isUppercase = isUppercaseFunc; - let _isVariableWidth = validator.isVariableWidth; - _isVariableWidth = isVariableWidthFunc; + let _isVariableWidth = validator.isVariableWidth; + _isVariableWidth = isVariableWidthFunc; - let _isWhitelisted = validator.isWhitelisted; - _isWhitelisted = isWhitelistedFunc; + let _isWhitelisted = validator.isWhitelisted; + _isWhitelisted = isWhitelistedFunc; - let _ltrim = validator.ltrim; - _ltrim = ltrimFunc; + let _ltrim = validator.ltrim; + _ltrim = ltrimFunc; - let _matches = validator.matches; - _matches = matchesFunc; + let _matches = validator.matches; + _matches = matchesFunc; - let _normalizeEmail = validator.normalizeEmail; - _normalizeEmail = normalizeEmailFunc; + let _normalizeEmail = validator.normalizeEmail; + _normalizeEmail = normalizeEmailFunc; - let _rtrim = validator.rtrim; - _rtrim = rtrimFunc; + let _rtrim = validator.rtrim; + _rtrim = rtrimFunc; - let _stripLow = validator.stripLow; - _stripLow = stripLowFunc; + let _stripLow = validator.stripLow; + _stripLow = stripLowFunc; - let _toBoolean = validator.toBoolean; - _toBoolean = toBooleanFunc; + let _toBoolean = validator.toBoolean; + _toBoolean = toBooleanFunc; - let _toDate = validator.toDate; - _toDate = toDateFunc; + let _toDate = validator.toDate; + _toDate = toDateFunc; - let _toFloat = validator.toFloat; - _toFloat = toFloatFunc; + let _toFloat = validator.toFloat; + _toFloat = toFloatFunc; - let _toInt = validator.toInt; - _toInt = toIntFunc; + let _toInt = validator.toInt; + _toInt = toIntFunc; - let _trim = validator.trim; - _trim = trimFunc; + let _trim = validator.trim; + _trim = trimFunc; - let _unescape = validator.unescape; - _unescape = unescapeFunc; + let _unescape = validator.unescape; + _unescape = unescapeFunc; - let _whitelist = validator.whitelist; - _whitelist = whitelistFunc; + let _whitelist = validator.whitelist; + _whitelist = whitelistFunc; } /************************************************ -* * -* API TESTS * -* * -************************************************/ -let any: any; + * * + * API TESTS * + * * + ************************************************/ +const any: any = null; // ************** // * Validators * // ************** { - let result: boolean; + let result: boolean; - result = validator.contains('sample', 'sample'); + result = validator.contains('sample', 'sample'); - result = validator.equals('sample', 'sample'); + result = validator.equals('sample', 'sample'); - result = validator.isAfter('sample'); - result = validator.isAfter('sample', new Date().toString()); + result = validator.isAfter('sample'); + result = validator.isAfter('sample', new Date().toString()); - result = validator.isAlpha('sample'); - result = validator.isAlpha('sample', 'ar'); - result = validator.isAlpha('sample', 'ar-AE'); - result = validator.isAlpha('sample', 'ar-BH'); - result = validator.isAlpha('sample', 'ar-DZ'); - result = validator.isAlpha('sample', 'ar-EG'); - result = validator.isAlpha('sample', 'ar-IQ'); - result = validator.isAlpha('sample', 'ar-JO'); - result = validator.isAlpha('sample', 'ar-KW'); - result = validator.isAlpha('sample', 'ar-LB'); - result = validator.isAlpha('sample', 'ar-LY'); - result = validator.isAlpha('sample', 'ar-MA'); - result = validator.isAlpha('sample', 'ar-QA'); - result = validator.isAlpha('sample', 'ar-QM'); - result = validator.isAlpha('sample', 'ar-SA'); - result = validator.isAlpha('sample', 'ar-SD'); - 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'); - result = validator.isAlpha('sample', 'en-IN'); - result = validator.isAlpha('sample', 'en-NZ'); - result = validator.isAlpha('sample', 'en-US'); - result = validator.isAlpha('sample', 'en-ZA'); - result = validator.isAlpha('sample', 'en-ZM'); - 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.isAlpha('sample'); + result = validator.isAlpha('sample', 'ar'); + result = validator.isAlpha('sample', 'ar-AE'); + result = validator.isAlpha('sample', 'ar-BH'); + result = validator.isAlpha('sample', 'ar-DZ'); + result = validator.isAlpha('sample', 'ar-EG'); + result = validator.isAlpha('sample', 'ar-IQ'); + result = validator.isAlpha('sample', 'ar-JO'); + result = validator.isAlpha('sample', 'ar-KW'); + result = validator.isAlpha('sample', 'ar-LB'); + result = validator.isAlpha('sample', 'ar-LY'); + result = validator.isAlpha('sample', 'ar-MA'); + result = validator.isAlpha('sample', 'ar-QA'); + result = validator.isAlpha('sample', 'ar-QM'); + result = validator.isAlpha('sample', 'ar-SA'); + result = validator.isAlpha('sample', 'ar-SD'); + 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'); + result = validator.isAlpha('sample', 'en-IN'); + result = validator.isAlpha('sample', 'en-NZ'); + result = validator.isAlpha('sample', 'en-US'); + result = validator.isAlpha('sample', 'en-ZA'); + result = validator.isAlpha('sample', 'en-ZM'); + 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'); - result = validator.isAlphanumeric('sample', 'ar-DZ'); - result = validator.isAlphanumeric('sample', 'ar-EG'); - result = validator.isAlphanumeric('sample', 'ar-IQ'); - result = validator.isAlphanumeric('sample', 'ar-JO'); - result = validator.isAlphanumeric('sample', 'ar-KW'); - result = validator.isAlphanumeric('sample', 'ar-LB'); - result = validator.isAlphanumeric('sample', 'ar-LY'); - result = validator.isAlphanumeric('sample', 'ar-MA'); - result = validator.isAlphanumeric('sample', 'ar-QA'); - result = validator.isAlphanumeric('sample', 'ar-QM'); - result = validator.isAlphanumeric('sample', 'ar-SA'); - result = validator.isAlphanumeric('sample', 'ar-SD'); - 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'); - result = validator.isAlphanumeric('sample', 'en-IN'); - result = validator.isAlphanumeric('sample', 'en-NZ'); - result = validator.isAlphanumeric('sample', 'en-US'); - result = validator.isAlphanumeric('sample', 'en-ZA'); - result = validator.isAlphanumeric('sample', 'en-ZM'); - result = validator.isAlphanumeric('sample', 'es-ES'); - result = validator.isAlphanumeric('sample', 'fr-FR'); - result = validator.isAlphanumeric('sample', 'hu-HU'); - 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.isAlphanumeric('sample'); + result = validator.isAlphanumeric('sample', 'ar'); + result = validator.isAlphanumeric('sample', 'ar-AE'); + result = validator.isAlphanumeric('sample', 'ar-BH'); + result = validator.isAlphanumeric('sample', 'ar-DZ'); + result = validator.isAlphanumeric('sample', 'ar-EG'); + result = validator.isAlphanumeric('sample', 'ar-IQ'); + result = validator.isAlphanumeric('sample', 'ar-JO'); + result = validator.isAlphanumeric('sample', 'ar-KW'); + result = validator.isAlphanumeric('sample', 'ar-LB'); + result = validator.isAlphanumeric('sample', 'ar-LY'); + result = validator.isAlphanumeric('sample', 'ar-MA'); + result = validator.isAlphanumeric('sample', 'ar-QA'); + result = validator.isAlphanumeric('sample', 'ar-QM'); + result = validator.isAlphanumeric('sample', 'ar-SA'); + result = validator.isAlphanumeric('sample', 'ar-SD'); + 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'); + result = validator.isAlphanumeric('sample', 'en-IN'); + result = validator.isAlphanumeric('sample', 'en-NZ'); + result = validator.isAlphanumeric('sample', 'en-US'); + result = validator.isAlphanumeric('sample', 'en-ZA'); + result = validator.isAlphanumeric('sample', 'en-ZM'); + result = validator.isAlphanumeric('sample', 'es-ES'); + result = validator.isAlphanumeric('sample', 'fr-FR'); + result = validator.isAlphanumeric('sample', 'hu-HU'); + 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'); + result = validator.isAscii('sample'); - result = validator.isBase64('sample'); + result = validator.isBase64('sample'); - result = validator.isBefore('sample'); - result = validator.isBefore('sample', new Date().toString()); + result = validator.isBefore('sample'); + result = validator.isBefore('sample', new Date().toString()); - result = validator.isBoolean('sample'); + result = validator.isBoolean('sample'); - let isByteLengthOptions: ValidatorJS.IsByteLengthOptions = {}; - result = validator.isByteLength('sample', isByteLengthOptions); - result = validator.isByteLength('sample', 0); - result = validator.isByteLength('sample', 0, 42); + const isByteLengthOptions: validator.IsByteLengthOptions = {}; + result = validator.isByteLength('sample', isByteLengthOptions); - result = validator.isCreditCard('sample'); + result = validator.isCreditCard('sample'); - let isCurrencyOptions: ValidatorJS.IsCurrencyOptions = {}; - result = validator.isCurrency('sample'); - result = validator.isCurrency('sample', isCurrencyOptions); + const isCurrencyOptions: validator.IsCurrencyOptions = {}; + result = validator.isCurrency('sample'); + result = validator.isCurrency('sample', isCurrencyOptions); - result = validator.isDataURI('sample'); + result = validator.isDataURI('sample'); - let isDecimalOptions: ValidatorJS.IsDecimalOptions = {}; - result = validator.isDecimal('sample'); - result = validator.isDecimal('sample', isDecimalOptions); + const isDecimalOptions: validator.IsDecimalOptions = {}; + result = validator.isDecimal('sample'); + result = validator.isDecimal('sample', isDecimalOptions); - result = validator.isDivisibleBy('sample', 2); + result = validator.isDivisibleBy('sample', 2); - let isEmailOptions: ValidatorJS.IsEmailOptions = {}; - result = validator.isEmail('sample'); - result = validator.isEmail('sample', isEmailOptions); + const isEmailOptions: validator.IsEmailOptions = {}; + result = validator.isEmail('sample'); + result = validator.isEmail('sample', isEmailOptions); - let isEmptyOptions: ValidatorJS.IsEmptyOptions = {}; - result = validator.isEmpty('sample'); - result = validator.isEmpty('sample', isEmptyOptions); + const isEmptyOptions: validator.IsEmptyOptions = {}; + result = validator.isEmpty('sample'); + result = validator.isEmpty('sample', isEmptyOptions); - let isFQDNOptions: ValidatorJS.IsFQDNOptions = {}; - result = validator.isFQDN('sample'); - result = validator.isFQDN('sample', isFQDNOptions); + const isFQDNOptions: validator.IsFQDNOptions = {}; + result = validator.isFQDN('sample'); + result = validator.isFQDN('sample', isFQDNOptions); - let isFloatOptions: ValidatorJS.IsFloatOptions = {}; - result = validator.isFloat('sample'); - result = validator.isFloat('sample', isFloatOptions); + const isFloatOptions: validator.IsFloatOptions = {}; + result = validator.isFloat('sample'); + result = validator.isFloat('sample', isFloatOptions); - result = validator.isFullWidth('sample'); + result = validator.isFullWidth('sample'); - result = validator.isHalfWidth('sample'); + 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.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.isHexColor('sample'); - result = validator.isHexadecimal('sample'); + result = validator.isHexadecimal('sample'); - result = validator.isIP('sample'); - result = validator.isIP('sample', 6); + result = validator.isIP('sample'); + result = validator.isIP('sample', '6'); - result = validator.isISBN('sample'); - result = validator.isISBN('sample', 13); + result = validator.isISBN('sample'); + result = validator.isISBN('sample', '13'); - let isISSNOptions: ValidatorJS.IsISSNOptions = {}; - result = validator.isISSN('sample'); - result = validator.isISSN('sample', isISSNOptions); + const isISSNOptions: validator.IsISSNOptions = {}; + result = validator.isISSN('sample'); + result = validator.isISSN('sample', isISSNOptions); - result = validator.isISIN('sample'); + result = validator.isISIN('sample'); - let isISO8601Options: ValidatorJS.IsISO8601Options = {}; - result = validator.isISO8601('sample'); - result = validator.isISO8601('sample', isISO8601Options); + const isISO8601Options: validator.IsISO8601Options = {}; + result = validator.isISO8601('sample'); + result = validator.isISO8601('sample', isISO8601Options); - result = validator.isISO31661Alpha2('sample'); - result = validator.isISO31661Alpha3('sample'); + result = validator.isISO31661Alpha2('sample'); + result = validator.isISO31661Alpha3('sample'); - result = validator.isISRC('sample'); + result = validator.isISRC('sample'); - result = validator.isIn('sample', []); + result = validator.isIn('sample', []); - let isIntOptions: ValidatorJS.IsIntOptions = {}; - result = validator.isInt('sample'); - result = validator.isInt('sample', isIntOptions); + const isIntOptions: validator.IsIntOptions = {}; + result = validator.isInt('sample'); + result = validator.isInt('sample', isIntOptions); - result = validator.isJSON('sample'); + result = validator.isJSON('sample'); - result = validator.isLatLong('sample'); + result = validator.isLatLong('sample'); - let isLengthOptions: ValidatorJS.IsLengthOptions = {}; - result = validator.isLength('sample', isLengthOptions); - result = validator.isLength('sample', 3); - result = validator.isLength('sample', 3, 5); + const isLengthOptions: validator.IsLengthOptions = {}; + result = validator.isLength('sample', isLengthOptions); - result = validator.isLowercase('sample'); + result = validator.isLowercase('sample'); - result = validator.isMACAddress('sample'); + result = validator.isMACAddress('sample'); - result = validator.isMD5('sample'); + result = validator.isMD5('sample'); - result = validator.isMimeType('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'); - result = validator.isMobilePhone('sample', 'el-GR'); - result = validator.isMobilePhone('sample', 'en-AU'); - 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.isMobilePhone("sample"); - result = validator.isMobilePhone("sample", [ "pl-PL", "pt-PT" ]); + const isMobilePhoneOptions: validator.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'); + result = validator.isMobilePhone('sample', 'el-GR'); + result = validator.isMobilePhone('sample', 'en-AU'); + 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.isMobilePhone('sample'); + result = validator.isMobilePhone('sample', ['pl-PL', 'pt-PT']); - result = validator.isMongoId('sample'); + result = validator.isMongoId('sample'); - result = validator.isMultibyte('sample'); + result = validator.isMultibyte('sample'); - result = validator.isNumeric('sample'); - result = validator.isNumeric('+358', { no_symbols: true }); + result = validator.isNumeric('sample'); + result = validator.isNumeric('+358', { no_symbols: true }); - result = validator.isPort('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'); - result = validator.isPostalCode('sample', 'DE'); - result = validator.isPostalCode('sample', 'DK'); - result = validator.isPostalCode('sample', 'DZ'); - result = validator.isPostalCode('sample', 'ES'); - result = validator.isPostalCode('sample', 'FI'); - result = validator.isPostalCode('sample', 'FR'); - result = validator.isPostalCode('sample', 'GB'); - result = validator.isPostalCode('sample', 'GR'); - result = validator.isPostalCode('sample', 'IL'); - result = validator.isPostalCode('sample', 'IN'); - result = validator.isPostalCode('sample', 'IS'); - result = validator.isPostalCode('sample', 'IT'); - result = validator.isPostalCode('sample', 'JP'); - result = validator.isPostalCode('sample', 'KE'); - result = validator.isPostalCode('sample', 'LI'); - result = validator.isPostalCode('sample', 'MX'); - result = validator.isPostalCode('sample', 'NL'); - result = validator.isPostalCode('sample', 'NO'); - result = validator.isPostalCode('sample', 'PL'); - result = validator.isPostalCode('sample', 'PT'); - result = validator.isPostalCode('sample', 'RO'); - result = validator.isPostalCode('sample', 'RU'); - result = validator.isPostalCode('sample', 'SA'); - result = validator.isPostalCode('sample', 'SE'); - result = validator.isPostalCode('sample', 'TW'); - result = validator.isPostalCode('sample', 'US'); - result = validator.isPostalCode('sample', 'ZA'); - result = validator.isPostalCode('sample', 'ZM'); - result = validator.isPostalCode('sample', 'any'); + 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'); + result = validator.isPostalCode('sample', 'DE'); + result = validator.isPostalCode('sample', 'DK'); + result = validator.isPostalCode('sample', 'DZ'); + result = validator.isPostalCode('sample', 'ES'); + result = validator.isPostalCode('sample', 'FI'); + result = validator.isPostalCode('sample', 'FR'); + result = validator.isPostalCode('sample', 'GB'); + result = validator.isPostalCode('sample', 'GR'); + result = validator.isPostalCode('sample', 'IL'); + result = validator.isPostalCode('sample', 'IN'); + result = validator.isPostalCode('sample', 'IS'); + result = validator.isPostalCode('sample', 'IT'); + result = validator.isPostalCode('sample', 'JP'); + result = validator.isPostalCode('sample', 'KE'); + result = validator.isPostalCode('sample', 'LI'); + result = validator.isPostalCode('sample', 'MX'); + result = validator.isPostalCode('sample', 'NL'); + result = validator.isPostalCode('sample', 'NO'); + result = validator.isPostalCode('sample', 'PL'); + result = validator.isPostalCode('sample', 'PT'); + result = validator.isPostalCode('sample', 'RO'); + result = validator.isPostalCode('sample', 'RU'); + result = validator.isPostalCode('sample', 'SA'); + result = validator.isPostalCode('sample', 'SE'); + result = validator.isPostalCode('sample', 'TW'); + result = validator.isPostalCode('sample', 'US'); + result = validator.isPostalCode('sample', 'ZA'); + result = validator.isPostalCode('sample', 'ZM'); + result = validator.isPostalCode('sample', 'any'); - result = validator.isSurrogatePair('sample'); + result = validator.isSurrogatePair('sample'); - let isURLOptions: ValidatorJS.IsURLOptions = {}; - result = validator.isURL('sample'); - result = validator.isURL('sample', isURLOptions); + const isURLOptions: validator.IsURLOptions = {}; + result = validator.isURL('sample'); + result = validator.isURL('sample', isURLOptions); - result = validator.isUUID('sample'); - result = validator.isUUID('sample', 5); - result = validator.isUUID('sample', 'all'); + result = validator.isUUID('sample'); + result = validator.isUUID('sample', 5); + result = validator.isUUID('sample', 'all'); - result = validator.isUppercase('sample'); + result = validator.isUppercase('sample'); - result = validator.isVariableWidth('sample'); + result = validator.isVariableWidth('sample'); - result = validator.isWhitelisted('sample', 'abc'); - result = validator.isWhitelisted('sample', ['a', 'b', 'c']); + result = validator.isWhitelisted('sample', 'abc'); + result = validator.isWhitelisted('sample', ['a', 'b', 'c']); - result = validator.matches('foobar', 'foo/i'); - result = validator.matches('foobar', 'foo', 'i'); + result = validator.matches('foobar', 'foo/i'); + result = validator.matches('foobar', 'foo', 'i'); } // ************** @@ -647,72 +643,66 @@ let any: any; // ************** { - let result: string; + let result: string; - result = validator.blacklist('sample', 'abc'); + result = validator.blacklist('sample', 'abc'); - result = validator.escape('sample'); + result = validator.escape('sample'); - result = validator.unescape('sample'); + result = validator.unescape('sample'); - result = validator.ltrim('sample'); - result = validator.ltrim('sample', ' '); + result = validator.ltrim('sample'); + result = validator.ltrim('sample', ' '); - let normalizeEmailOptions: ValidatorJS.NormalizeEmailOptions = {}; - let normalizeResult: string | false; - normalizeResult = validator.normalizeEmail('sample'); - normalizeResult = validator.normalizeEmail('sample', normalizeEmailOptions); + const normalizeEmailOptions: validator.NormalizeEmailOptions = {}; + let normalizeResult: string | false; + normalizeResult = validator.normalizeEmail('sample'); + normalizeResult = validator.normalizeEmail('sample', normalizeEmailOptions); - result = validator.rtrim('sample'); - result = validator.rtrim('sample', ' '); + result = validator.rtrim('sample'); + result = validator.rtrim('sample', ' '); - result = validator.stripLow('sample'); - result = validator.stripLow('sample', true); + result = validator.stripLow('sample'); + result = validator.stripLow('sample', true); } { - let result: boolean; + let result: boolean; - result = validator.toBoolean(any); - result = validator.toBoolean(any, true); + result = validator.toBoolean(any); + result = validator.toBoolean(any, true); } { - let result: Date; + let result: Date | null; - result = validator.toDate(any); + result = validator.toDate(any); } { - let result: number; + let result: number; - result = validator.toFloat(any); + result = validator.toFloat(any); - result = validator.toInt(any); - result = validator.toInt(any, 10); + result = validator.toInt(any); + result = validator.toInt(any, 10); } { - let result: string; + let result: string; - result = validator.trim('sample'); - result = validator.trim('sample', ' '); + result = validator.trim('sample'); + result = validator.trim('sample', ' '); - result = validator.whitelist('sample', 'abc'); + result = validator.whitelist('sample', 'abc'); } { - let str: string; - str = validator.toString([123, 456, '123', '456', true, false]); + let str: string; + str = validator.toString([123, 456, '123', '456', true, false]); } { - let ver: string; - ver = validator.version; + let ver: string; + ver = validator.version; } - -// ************** -// * Extensions * -// ************** - -validator.extend<(str: string, options: {}) => boolean>('isTest', (str: any, options: {}) => !str);