@types/validator
- Version 13.12.2
- Published
- 73.2 kB
- No dependencies
- MIT license
Install
npm i @types/validator
yarn add @types/validator
pnpm add @types/validator
Overview
TypeScript definitions for validator
Index
Variables
Functions
- blacklist()
- contains()
- equals()
- escape()
- isAbaRouting()
- isAfter()
- isAlpha()
- isAlphanumeric()
- isAscii()
- isBase32()
- isBase58()
- isBase64()
- isBefore()
- isBIC()
- isBtcAddress()
- isByteLength()
- isCreditCard()
- isCurrency()
- isDataURI()
- isDate()
- isDecimal()
- isDivisibleBy()
- isEAN()
- isEmpty()
- isEthereumAddress()
- isFloat()
- isFullWidth()
- isHalfWidth()
- isHash()
- isHexadecimal()
- isHexColor()
- isHSL()
- isIdentityCard()
- isIMEI()
- isIn()
- isInt()
- isIP()
- isIPRange()
- isISBN()
- isISIN()
- isISO31661Alpha3()
- isISO6346()
- isISO8601()
- isISRC()
- isISSN()
- isJSON()
- isJWT()
- isLatLong()
- isLength()
- isLicensePlate()
- isLocale()
- isLowercase()
- isLuhnNumber()
- isMACAddress()
- isMagnetURI()
- isMailtoURI()
- isMD5()
- isMimeType()
- isMobilePhone()
- isMongoId()
- isMultibyte()
- isNumeric()
- isOctal()
- isPassportNumber()
- isPort()
- isPostalCode()
- isRFC3339()
- isRgbColor()
- isSemVer()
- isSlug()
- isStrongPassword()
- isSurrogatePair()
- isTime()
- isUppercase()
- isUUID()
- isVariableWidth()
- isVAT()
- isWhitelisted()
- ltrim()
- matches()
- normalizeEmail()
- rtrim()
- stripLow()
- toBoolean()
- toDate()
- toFloat()
- toInt()
- toString()
- trim()
- unescape()
- whitelist()
Interfaces
Type Aliases
Variables
variable _default
const _default: typeof validator;
variable ibanLocales
const ibanLocales: ( | 'ES' | 'FI' | 'IR' | 'IT' | 'NO' | 'PL' | 'AD' | 'AT' | 'BE' | 'BG' | 'BR' | 'CH' | 'CZ' | 'DE' | 'DK' | 'EE' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'IE' | 'IL' | 'IS' | 'LI' | 'LT' | 'LU' | 'LV' | 'MT' | 'NL' | 'PT' | 'RO' | 'SA' | 'SE' | 'SI' | 'SK' | 'TN' | 'UA' | 'AE' | 'AL' | 'AZ' | 'BA' | 'BH' | 'BY' | 'CR' | 'CY' | 'DO' | 'EG' | 'FO' | 'GE' | 'GI' | 'GL' | 'GT' | 'IQ' | 'JO' | 'KW' | 'KZ' | 'LB' | 'LC' | 'MC' | 'MD' | 'ME' | 'MK' | 'MR' | 'MU' | 'MZ' | 'PK' | 'PS' | 'QA' | 'RS' | 'SC' | 'SM' | 'SV' | 'TL' | 'TR' | 'VA' | 'VG' | 'XK')[];
variable isAlphaLocales
const isAlphaLocales: AlphaLocale[];
variable isAlphanumericLocales
const isAlphanumericLocales: AlphanumericLocale[];
variable isBoolean
const isBoolean: (str: string, options?: _isBoolean.Options) => boolean;
variable isEmail
const isEmail: (str: string, options?: _isEmail.IsEmailOptions) => boolean;
variable isFloatLocales
const isFloatLocales: FloatLocale[];
variable isFQDN
const isFQDN: (str: string, options?: _isFQDN.IsFQDNOptions) => boolean;
variable isFreightContainerID
const isFreightContainerID: (str: string) => boolean;
alias for
isISO6346
, check if the string is a valid [ISO 6346](https://en.wikipedia.org/wiki/ISO_6346) shipping container identification.
variable isIBAN
const isIBAN: (str: string, options?: _isIBAN.IsIBANOptions) => boolean;
variable isISO31661Alpha2
const isISO31661Alpha2: (str: string) => boolean;
variable isISO4217
const isISO4217: (str: string) => boolean;
variable isISO6391
const isISO6391: (str: string) => boolean;
Check if the string is a valid [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) officially assigned language code.
variable isMobilePhoneLocales
const isMobilePhoneLocales: MobilePhoneLocale[];
variable isPostalCodeLocales
const isPostalCodeLocales: PostalCodeLocale[];
variable isTaxID
const isTaxID: (str: string, locale?: string) => boolean;
variable isURL
const isURL: (str: string, options?: _isURL.IsURLOptions) => boolean;
variable version
const version: string;
Functions
function blacklist
blacklist: (input: string, chars: string) => string;
Remove characters that appear in the blacklist.
Parameter chars
The characters are used in a
RegExp
and so you will need to escape some chars, e.g.blacklist(input, '\\[\\]')
.
function contains
contains: (str: string, seed: any, options?: ContainsOptions) => boolean;
Check if the string contains the seed.
Parameter seed
Seed
function equals
equals: (str: string, comparison: string) => boolean;
Check if the string matches the comparison.
Parameter comparison
String to compare
function escape
escape: (input: string) => string;
Replace
<
,>
,&
,'
,"
and/
with HTML entities.
function isAbaRouting
isAbaRouting: (str: string) => boolean;
Check if the string is an ABA routing number for US bank account / cheque.
function isAfter
isAfter: (str: string, date?: string) => boolean;
Check if the string is a date that's after the specified date.
Parameter date
Date string (defaults to now)
function isAlpha
isAlpha: ( str: string, locale?: AlphaLocale, options?: IsAlphaOptions) => boolean;
Check if the string contains only letters (a-zA-Z).
Parameter locale
AlphaLocale
Parameter options
IsAlphaOptions
function isAlphanumeric
isAlphanumeric: ( str: string, locale?: AlphanumericLocale, options?: IsAlphanumericOptions) => boolean;
Check if the string contains only letters and numbers.
Parameter locale
AlphanumericLocale
Parameter options
IsAlphanumericOptions
function isAscii
isAscii: (str: string) => boolean;
Check if the string contains ASCII chars only.
function isBase32
isBase32: (str: string) => boolean;
Check if a string is base32 encoded.
function isBase58
isBase58: (str: string) => boolean;
check if a string is base58 encoded
function isBase64
isBase64: (str: string, options?: IsBase64Options) => boolean;
Check if a string is base64 encoded.
Parameter options
Options
function isBefore
isBefore: (str: string, date?: string) => boolean;
Check if the string is a date that's before the specified date.
Parameter date
Date string (defaults to now)
function isBIC
isBIC: (str: string) => boolean;
Check if a string is a BIC (Bank Identification Code) or SWIFT code.
function isBtcAddress
isBtcAddress: (str: string) => boolean;
Check if the string is a valid BTC address.
function isByteLength
isByteLength: (str: string, options?: IsByteLengthOptions) => boolean;
Check if the string's length (in UTF-8 bytes) falls in a range.
Parameter options
Options
function isCreditCard
isCreditCard: (str: string, options?: IsCreditCardOptions) => boolean;
Check if the string is a credit card.
function isCurrency
isCurrency: (str: string, options?: IsCurrencyOptions) => boolean;
Check if the string is a valid currency amount.
Parameter options
Options
function isDataURI
isDataURI: (str: string) => boolean;
Check if the string is a [data uri format](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs).
function isDate
isDate: (str: string, options?: IsDateOptions) => boolean;
Check if the string is a valid date.
function isDecimal
isDecimal: (str: string, options?: IsDecimalOptions) => boolean;
Check if the string represents a decimal number, such as
0.1
,.3
,1.1
,1.00003
,4.0
etc.Parameter options
Options
function isDivisibleBy
isDivisibleBy: (str: string, number: number) => boolean;
Check if the string is a number that's divisible by another.
Parameter number
Divider number
function isEAN
isEAN: (str: string) => boolean;
Check if the string is an EAN (European Article Number).
function isEmpty
isEmpty: (str: string, options?: IsEmptyOptions) => boolean;
Check if the string has a length of zero.
Parameter options
Options
function isEthereumAddress
isEthereumAddress: (str: string) => boolean;
Check if the string is an [Ethereum](https://ethereum.org/) address using basic regex. Does not validate address checksums.
function isFloat
isFloat: (str: string, options?: IsFloatOptions) => boolean;
Check if the string is a float.
Parameter options
Options
function isFullWidth
isFullWidth: (str: string) => boolean;
Check if the string contains any full-width chars.
function isHalfWidth
isHalfWidth: (str: string) => boolean;
Check if the string contains any half-width chars.
function isHash
isHash: (str: string, algorithm: HashAlgorithm) => boolean;
Check if the string is a hash of export type algorithm.
Parameter algorithm
HashAlgorithm
function isHexadecimal
isHexadecimal: (str: string) => boolean;
Check if the string is a hexadecimal number.
function isHexColor
isHexColor: (str: string) => boolean;
Check if the string is a hexadecimal color.
function isHSL
isHSL: (str: string) => boolean;
Check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on CSS Colors Level 4 specification. Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: hsl(200grad+.1%62%/1)).
function isIdentityCard
isIdentityCard: (str: string, locale?: 'any' | IdentityCardLocale) => boolean;
Check if the string is a valid identity card code.
Parameter locale
IdentityCardLocale
function isIMEI
isIMEI: (str: string, options?: IsIMEIOptions) => boolean;
Check if the string is a valid IMEI. Non-hyphenated (
###############
) only is supported by default. Use theoptions
param to enable hyphenated (##-######-######-#
) support.Parameter options
Options
function isIn
isIn: (str: string, values: any[]) => boolean;
Check if the string is in a array of allowed values.
Parameter values
Allowed values.
function isInt
isInt: (str: string, options?: IsIntOptions) => boolean;
Check if the string is an integer.
Parameter options
Options
function isIP
isIP: (str: string, version?: IPVersion) => boolean;
Check if the string is an IP (version 4 or 6).
Parameter version
IP Version
function isIPRange
isIPRange: (str: string, version?: IPVersion) => boolean;
Check if the string is an IP Range (version 4 or 6).
function isISBN
isISBN: (str: string, version?: ISBNVersion) => boolean;
Check if the string is an ISBN (version 10 or 13).
Parameter version
ISBN Version
function isISIN
isISIN: (str: string) => boolean;
Check if the string is an [ISIN](https://en.wikipedia.org/wiki/International_Securities_Identification_Number) (stock/security identifier).
function isISO31661Alpha3
isISO31661Alpha3: (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.
function isISO6346
isISO6346: (str: string) => boolean;
check if the string is a valid [ISO 6346](https://en.wikipedia.org/wiki/ISO_6346) shipping container identification.
Parameter str
function isISO8601
isISO8601: (str: string, options?: IsISO8601Options) => boolean;
Check if the string is a valid [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date.
Parameter options
Options
function isISRC
isISRC: (str: string) => boolean;
Check if the string is a [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code).
function isISSN
isISSN: (str: string, options?: IsISSNOptions) => boolean;
Check if the string is an [ISSN](https://en.wikipedia.org/wiki/International_Standard_Serial_Number).
Parameter options
Options
function isJSON
isJSON: (str: string) => boolean;
Check if the string is valid JSON (note: uses
JSON.parse
).
function isJWT
isJWT: (str: string) => boolean;
Check if the string is valid JWT token.
function isLatLong
isLatLong: (str: string) => boolean;
Check if the string is a valid latitude-longitude coordinate in the format:
lat,long
orlat, long
.
function isLength
isLength: (str: string, options?: IsLengthOptions) => boolean;
Check if the string's length falls in a range.
Note: this export function takes into account surrogate pairs.
Parameter options
Options
function isLicensePlate
isLicensePlate: { (str: string, locale: LicensePlateLocale): boolean; (str: string, locale: string): unknown;};
Check if the string matches the format of a country's license plate.
function isLocale
isLocale: (str: string) => boolean;
Check if the string is a locale.
function isLowercase
isLowercase: (str: string) => boolean;
Check if the string is lowercase.
function isLuhnNumber
isLuhnNumber: (str: string) => boolean;
Check if the string passes the [Luhn algorithm check](https://en.m.wikipedia.org/wiki/Luhn_algorithm).
function isMACAddress
isMACAddress: (str: string, options?: IsMACAddressOptions) => boolean;
Check if the string is a MAC address.
Parameter options
Options
function isMagnetURI
isMagnetURI: (str: string) => boolean;
Check if the string is a [magnet uri format](https://en.wikipedia.org/wiki/Magnet_URI_scheme).
function isMailtoURI
isMailtoURI: (str: string, options?: IsEmailOptions) => boolean;
check if the string is a [Magnet URI format][Mailto URI Format].
options
is an object of validating emails inside the URI (checkisEmail
s options for details).Parameter str
Parameter options
function isMD5
isMD5: (str: string) => boolean;
Check if the string is a MD5 hash.
function isMimeType
isMimeType: (str: string) => boolean;
Check if the string matches to a valid [MIME export type](https://en.wikipedia.org/wiki/Media_export type) format.
function isMobilePhone
isMobilePhone: ( str: string, locale?: 'any' | MobilePhoneLocale | MobilePhoneLocale[], options?: IsMobilePhoneOptions) => boolean;
Check if the string is a mobile phone number.
Parameter locale
MobilePhoneLocale(s)
Parameter options
Options
function isMongoId
isMongoId: (str: string) => boolean;
Check if the string is a valid hex-encoded representation of a [MongoDB ObjectId](http://docs.mongodb.org/manual/reference/object-id/).
function isMultibyte
isMultibyte: (str: string) => boolean;
Check if the string contains one or more multibyte chars.
function isNumeric
isNumeric: (str: string, options?: IsNumericOptions) => boolean;
Check if the string contains only numbers.
Parameter options
Options
function isOctal
isOctal: (str: string) => boolean;
Check if the string is a valid octal number.
function isPassportNumber
isPassportNumber: (str: string, countryCode?: string) => boolean;
Check if the string is a valid passport number relative to a specific country code.
Parameter countryCode
Country code
function isPort
isPort: (str: string) => boolean;
Check if the string is a valid port number.
function isPostalCode
isPostalCode: (str: string, locale: 'any' | PostalCodeLocale) => boolean;
Check if the string is a postal code
Parameter locale
PostalCodeLocale
function isRFC3339
isRFC3339: (str: string) => boolean;
Check if the string is a valid [RFC 3339](https://tools.ietf.org/html/rfc3339) date.
function isRgbColor
isRgbColor: (str: string, includePercentValues?: boolean) => boolean;
Check if the string is a rgb or rgba color.
Parameter includePercentValues
If you don't want to allow to set rgb or rgba values with percents, like rgb(5%,5%,5%), or rgba(90%,90%,90%,.3), then set it to false. (defaults to true)
function isSemVer
isSemVer: (str: string) => boolean;
Check if the string is a Semantic Versioning Specification (SemVer).
function isSlug
isSlug: (str: string) => boolean;
Check if the string is of export type slug.
function isStrongPassword
isStrongPassword: { ( str: string, options?: StrongPasswordOptions & { returnScore?: false | undefined } ): boolean; (str: string, options: StrongPasswordOptions & { returnScore: true }): number;};
function isSurrogatePair
isSurrogatePair: (str: string) => boolean;
Check if the string contains any surrogate pairs chars.
function isTime
isTime: (str: string, options?: IsTimeOptions) => boolean;
Check if the string is a valid time.
function isUppercase
isUppercase: (str: string) => boolean;
Check if the string is uppercase.
function isUUID
isUUID: (str: string, version?: UUIDVersion) => boolean;
Check if the string is a UUID (version 1, 2, 3, 4, 5 or 7).
Parameter version
UUID version
function isVariableWidth
isVariableWidth: (str: string) => boolean;
Check if the string contains a mixture of full and half-width chars.
function isVAT
isVAT: (str: string, countryCode: string) => boolean;
Checks that the string is a [valid VAT number
function isWhitelisted
isWhitelisted: (str: string, chars: string | string[]) => boolean;
Checks characters if they appear in the whitelist.
Parameter chars
whitelist
function ltrim
ltrim: (input: string, chars?: string) => string;
Trim characters from the left-side of the input.
Parameter chars
characters (defaults to whitespace)
function matches
matches: { (str: string, pattern: RegExp): boolean; (str: string, pattern: string, modifiers?: string): boolean;};
Check if string matches the pattern.
Parameter pattern
/foo/i
Check if string matches the pattern.
Parameter pattern
'foo'
Parameter modifiers
'i'
function normalizeEmail
normalizeEmail: ( email: string, options?: NormalizeEmailOptions) => string | false;
Canonicalizes an email address. (This doesn't validate that the input is an email, if you want to validate the email use
isEmail
beforehand)Parameter options
Options
function rtrim
rtrim: (input: string, chars?: string) => string;
Trim characters from the right-side of the input.
Parameter chars
characters (defaults to whitespace)
function stripLow
stripLow: (input: string, keep_new_lines?: boolean) => string;
Remove characters with a numerical value <
32
and127
, mostly control characters. Unicode-safe in JavaScript.Parameter keep_new_lines
if
true
, newline characters are preserved (\n
and\r
, hex0xA
and0xD
).
function toBoolean
toBoolean: (input: string, strict?: boolean) => boolean;
Convert the input string to a boolean. Everything except for
'0'
,'false'
and''
returnstrue
.Parameter strict
in
strict
mode, only'1'
and'true'
returntrue
.
function toDate
toDate: (input: string) => Date | null;
Convert the input string to a
Date
, ornull
if the input is not a date.
function toFloat
toFloat: (input: string) => number;
Convert the input string to a float, or
NaN
if the input is not a float.
function toInt
toInt: (input: string, radix?: number) => number;
Convert the input string to an integer, or
NaN
if the input is not an integer.Parameter radix
radix or base (defaults to 10)
function toString
toString: (input: any) => string;
Converts to string.
function trim
trim: (input: string, chars?: string) => string;
Trim characters from both sides of the input.
Parameter chars
characters (defaults to whitespace)
function unescape
unescape: (input: string) => string;
Replaces HTML encoded entities with
<
,>
,&
,'
,"
and/
.
function whitelist
whitelist: (input: string, chars: string) => string;
Remove characters that do not appear in the whitelist.
Parameter chars
The characters are used in a
RegExp
and so you will need to escape some chars, e.g.whitelist(input, '\\[\\]')
.
Interfaces
interface ContainsOptions
interface ContainsOptions {}
**************** ** Validators *** ****************
property ignoreCase
ignoreCase?: boolean | undefined;
false
property minOccurrences
minOccurrences?: number | undefined;
1
interface IsAlphanumericOptions
interface IsAlphanumericOptions {}
property ignore
ignore?: string | RegExp | undefined;
undefined
interface IsAlphaOptions
interface IsAlphaOptions {}
property ignore
ignore?: string | RegExp | undefined;
undefined
interface IsBase64Options
interface IsBase64Options {}
property urlSafe
urlSafe?: boolean | undefined;
false
interface IsByteLengthOptions
interface IsByteLengthOptions {}
interface IsCreditCardOptions
interface IsCreditCardOptions {}
property provider
provider?: | 'amex' | 'dinersclub' | 'discover' | 'jcb' | 'mastercard' | 'unionpay' | 'visa' | '';
undefined
interface IsCurrencyOptions
interface IsCurrencyOptions {}
property allow_decimal
allow_decimal?: boolean | undefined;
true
property allow_negative_sign_placeholder
allow_negative_sign_placeholder?: boolean | undefined;
false
property allow_negatives
allow_negatives?: boolean | undefined;
true
property allow_space_after_digits
allow_space_after_digits?: boolean | undefined;
false
property allow_space_after_symbol
allow_space_after_symbol?: boolean | undefined;
false
property decimal_separator
decimal_separator?: string | undefined;
'.'
property digits_after_decimal
digits_after_decimal?: number[] | undefined;
The array
digits_after_decimal
is filled with the exact number of digits allowed not a range, for example a range1
to3
will be given as[1, 2, 3]
.[2]
property negative_sign_after_digits
negative_sign_after_digits?: boolean | undefined;
false
property negative_sign_before_digits
negative_sign_before_digits?: boolean | undefined;
false
property parens_for_negatives
parens_for_negatives?: boolean | undefined;
false
property require_decimal
require_decimal?: boolean | undefined;
false
property require_symbol
require_symbol?: boolean | undefined;
false
property symbol
symbol?: string | undefined;
'$'
property symbol_after_digits
symbol_after_digits?: boolean | undefined;
false
property thousands_separator
thousands_separator?: string | undefined;
','
interface IsDateOptions
interface IsDateOptions {}
property delimiters
delimiters?: string[] | undefined;
delimiters
is an array of allowed date delimiters['/', '-']
property format
format?: string | undefined;
false
property strictMode
strictMode?: boolean | undefined;
If strictMode is set to true, the validator will reject inputs different from format.
false
interface IsDecimalOptions
interface IsDecimalOptions {}
property decimal_digits
decimal_digits?: string | undefined;
decimal_digits
is given as a range like'1,3'
, a specific value like'3'
or min like'1,'
'1,'
property force_decimal
force_decimal?: boolean | undefined;
false
property locale
locale?: DecimalLocale | undefined;
DecimalLocale
'en-US'
interface IsEmptyOptions
interface IsEmptyOptions {}
property ignore_whitespace
ignore_whitespace?: boolean | undefined;
false
interface IsFloatOptions
interface IsFloatOptions {}
interface IsIMEIOptions
interface IsIMEIOptions {}
property allow_hyphens
allow_hyphens?: boolean | undefined;
This value is
false
by default. Set totrue
to allow IMEI with hyphens.
interface IsIntOptions
interface IsIntOptions {}
property allow_leading_zeroes
allow_leading_zeroes?: boolean | undefined;
if
false
, will disallow integer values with leading zeroes true
property gt
gt?: number | undefined;
enforce integers being less than the value provided
property lt
lt?: number | undefined;
enforce integers being greater than the value provided
property max
max?: number | undefined;
to check the integer max boundary
property min
min?: number | undefined;
to check the integer min boundary
interface IsISO8601Options
interface IsISO8601Options {}
property strict
strict?: boolean | undefined;
If
strict
istrue
, performs additional checks for valid dates, e.g. invalidates dates like2009-02-29
.false
property strictSeparator
strictSeparator?: boolean | undefined;
If
strictSeparator
is true, date strings with date and time separated by anything other than a T will be invalid
interface IsISSNOptions
interface IsISSNOptions {}
property case_sensitive
case_sensitive?: boolean | undefined;
If
case_sensitive
istrue
, ISSNs with a lowercasex
as the check digit are rejected.false
property require_hyphen
require_hyphen?: boolean | undefined;
false
interface IsLengthOptions
interface IsLengthOptions {}
interface IsMACAddressOptions
interface IsMACAddressOptions {}
property eui
eui?: '48' | '64' | undefined;
Setting
eui
allows for validation against EUI-48 or EUI-64 instead of both.
property no_colons
no_colons?: boolean | undefined;
If
no_colons
istrue
, 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
or01-02-03-04-05-ab
.false
Deprecated
use no_separators instead
property no_separators
no_separators?: boolean | undefined;
If
no_separators
istrue
, 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
or01-02-03-04-05-ab
.false
interface IsMobilePhoneOptions
interface IsMobilePhoneOptions {}
property strictMode
strictMode?: boolean | undefined;
If this is set to
true
, the mobile phone number must be supplied with the country code and therefore must start with+
.false
interface IsNumericOptions
interface IsNumericOptions {}
property locale
locale?: AlphaLocale | undefined;
property no_symbols
no_symbols?: boolean | undefined;
If
no_symbols
is true, the validator will reject numeric strings that feature a symbol (e.g.+
,-
, or.
).false
interface IsTimeOptions
interface IsTimeOptions {}
property hourFormat
hourFormat?: 'hour12' | 'hour24';
'hour24' will validate hours in 24 format and 'hour12' will validate hours in 12 format. 'hour24'
property mode
mode?: 'default' | 'withSeconds';
'default' will validate HH:MM format, 'withSeconds' will validate the HH:MM:SS format
'default'
interface NormalizeEmailOptions
interface NormalizeEmailOptions {}
property all_lowercase
all_lowercase?: boolean | undefined;
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.
true
property gmail_convert_googlemaildotcom
gmail_convert_googlemaildotcom?: boolean | undefined;
Converts addresses with domain
@googlemail.com
to@gmail.com
, as they're equivalent.true
property gmail_lowercase
gmail_lowercase?: boolean | undefined;
GMail addresses are known to be case-insensitive, so this switch allows lowercasing them even when
all_lowercase
is set tofalse
. Please note that whenall_lowercase
istrue
, GMail addresses are lowercased regardless of the value of this setting.true
property gmail_remove_dots
gmail_remove_dots?: boolean | undefined;
Removes dots from the local part of the email address, as GMail ignores them (e.g.
"john.doe"
and"johndoe"
are considered equal).true
property gmail_remove_subaddress
gmail_remove_subaddress?: boolean | undefined;
Normalizes addresses by removing "sub-addresses", which is the part following a
"+"
sign (e.g."foo+bar@gmail.com"
becomes"foo@gmail.com"
).true
property icloud_lowercase
icloud_lowercase?: boolean | undefined;
iCloud addresses (including MobileMe) are known to be case-insensitive, so this switch allows lowercasing them even when
all_lowercase
is set tofalse
. Please note that whenall_lowercase
istrue
, iCloud addresses are lowercased regardless of the value of this setting.true
property icloud_remove_subaddress
icloud_remove_subaddress?: boolean | undefined;
Normalizes addresses by removing "sub-addresses", which is the part following a
"+"
sign (e.g."foo+bar@icloud.com"
becomes"foo@icloud.com"
).true
property outlookdotcom_lowercase
outlookdotcom_lowercase?: boolean | undefined;
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 tofalse
. Please note that whenall_lowercase
istrue
, Outlook.com addresses are lowercased regardless of the value of this setting.true
property outlookdotcom_remove_subaddress
outlookdotcom_remove_subaddress?: boolean | undefined;
Normalizes addresses by removing "sub-addresses", which is the part following a
"+"
sign (e.g."foo+bar@outlook.com"
becomes"foo@outlook.com"
).true
property yahoo_lowercase
yahoo_lowercase?: boolean | undefined;
Yahoo Mail addresses are known to be case-insensitive, so this switch allows lowercasing them even when
all_lowercase
is set tofalse
. Please note that whenall_lowercase
istrue
, Yahoo Mail addresses are lowercased regardless of the value of this setting.true
property yahoo_remove_subaddress
yahoo_remove_subaddress?: boolean | undefined;
Normalizes addresses by removing "sub-addresses", which is the part following a
"-"
sign (e.g."foo-bar@yahoo.com"
becomes"foo@yahoo.com"
).true
interface StrongPasswordOptions
interface StrongPasswordOptions {}
Check if string is considered a strong password. Allows options to be added
property minLength
minLength?: number | undefined;
property minLowercase
minLowercase?: number | undefined;
property minNumbers
minNumbers?: number | undefined;
property minSymbols
minSymbols?: number | undefined;
property minUppercase
minUppercase?: number | undefined;
property pointsForContainingLower
pointsForContainingLower?: number | undefined;
property pointsForContainingNumber
pointsForContainingNumber?: number | undefined;
property pointsForContainingSymbol
pointsForContainingSymbol?: number | undefined;
property pointsForContainingUpper
pointsForContainingUpper?: number | undefined;
property pointsPerRepeat
pointsPerRepeat?: number | undefined;
property pointsPerUnique
pointsPerUnique?: number | undefined;
property returnScore
returnScore?: boolean | undefined;
Type Aliases
type AlphaLocale
type AlphaLocale = | 'en-US' | 'bg-BG' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'es-AR' | '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';
type AlphanumericLocale
type AlphanumericLocale = | 'en-US' | 'bg-BG' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'el-GR' | 'es-AR' | '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';
type DecimalLocale
type DecimalLocale = FloatLocale;
type FloatLocale
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';
type HashAlgorithm
type HashAlgorithm = | 'md4' | 'md5' | 'sha1' | 'sha256' | 'sha384' | 'sha512' | 'ripemd128' | 'ripemd160' | 'tiger128' | 'tiger160' | 'tiger192' | 'crc32' | 'crc32b';
type IdentityCardLocale
type IdentityCardLocale = | 'ar-LY' | 'ar-TN' | 'ES' | 'FI' | 'he-IL' | 'IN' | 'IR' | 'IT' | 'LK' | 'NO' | 'PL' | 'TH' | 'zh-CN' | 'zh-HK' | 'zh-TW';
type IPVersion
type IPVersion = '4' | '6' | 4 | 6;
type ISBNVersion
type ISBNVersion = '10' | '13' | 10 | 13;
type IsEmailOptions
type IsEmailOptions = _isEmail.IsEmailOptions;
type IsFQDNOptions
type IsFQDNOptions = _isFQDN.IsFQDNOptions;
type IsURLOptions
type IsURLOptions = _isURL.IsURLOptions;
type LicensePlateLocale
type LicensePlateLocale = | 'cs-CZ' | 'de-DE' | 'de-LI' | 'en-IN' | 'es-AR' | 'hu-HU' | 'pt-BR' | 'pt-PT' | 'sq-AL' | 'sv-SE' | 'en-PK' | 'any';
type MobilePhoneLocale
type MobilePhoneLocale = PhoneLocale | PhoneLocaleAlias;
type PhoneLocale
type PhoneLocale = | 'am-AM' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-LB' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LY' | 'ar-MA' | 'ar-OM' | 'ar-SA' | 'ar-SY' | 'ar-TN' | 'az-AZ' | 'bs-BA' | 'be-BY' | 'bg-BG' | 'bn-BD' | 'ca-AD' | 'cs-CZ' | 'da-DK' | 'de-DE' | 'de-AT' | 'de-CH' | 'de-LU' | 'el-GR' | 'en-AU' | 'en-GB' | 'en-GG' | 'en-GH' | 'en-HK' | 'en-MO' | 'en-IE' | 'en-IN' | 'en-KE' | 'en-MT' | 'en-MU' | 'en-NG' | 'en-NZ' | 'en-PK' | 'en-PH' | 'en-RW' | 'en-SG' | 'en-SL' | 'en-TZ' | 'en-UG' | 'en-US' | 'en-ZA' | 'en-ZM' | 'en-ZW' | 'es-AR' | 'es-BO' | 'es-CO' | 'es-CL' | 'es-CR' | 'es-DO' | 'es-HN' | 'es-EC' | 'es-ES' | 'es-PE' | 'es-MX' | 'es-PA' | 'es-PY' | 'es-UY' | 'es-VE' | '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' | 'it-SM' | 'ja-JP' | 'ka-GE' | 'kk-KZ' | 'kl-GL' | 'ko-KR' | 'lt-LT' | 'lv-LV' | 'ms-MY' | 'mz-MZ' | 'nb-NO' | 'ne-NP' | 'nl-BE' | 'nl-NL' | 'nn-NO' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'pt-AO' | 'ro-RO' | 'ru-RU' | 'si-LK' | 'sl-SI' | 'sk-SK' | 'sq-AL' | 'sr-RS' | 'sv-SE' | 'th-TH' | 'tr-TR' | 'uk-UA' | 'uz-UZ' | 'vi-VN' | 'zh-CN' | 'zh-TW';
type PhoneLocaleAlias
type PhoneLocaleAlias = | 'en-CA' | 'fr-CA' | 'fr-BE' | 'zh-HK' | 'zh-MO' | 'ga-IE' | 'fr-CH' | 'it-CH';
type PostalCodeLocale
type PostalCodeLocale = | 'AD' | 'AT' | 'AU' | 'BE' | 'BG' | 'BR' | 'CA' | 'CH' | 'CN' | 'CZ' | 'DE' | 'DK' | 'DZ' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'ID' | 'IE' | 'IL' | 'IN' | 'IR' | 'IS' | 'IT' | 'JP' | 'KE' | 'KR' | 'LI' | 'LT' | 'LU' | 'LV' | 'MX' | 'MT' | 'NL' | 'NO' | 'NZ' | 'PL' | 'PR' | 'PT' | 'RO' | 'RU' | 'SA' | 'SE' | 'SI' | 'SK' | 'TN' | 'TW' | 'UA' | 'US' | 'ZA' | 'ZM';
type UUIDVersion
type UUIDVersion = '1' | '2' | '3' | '4' | '5' | '7' | 'all' | 1 | 2 | 3 | 4 | 5 | 7;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/validator
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/validator)
- HTML<a href="https://www.jsdocs.io/package/@types/validator"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5750 ms. - Missing or incorrect documentation? Open an issue for this package.