Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update a few APIs #12

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ declare namespace validator {
// check if the string contains ASCII chars only.
isAscii(str: string): boolean;

// check if a string is base32 encoded.
isBase32(str: string): boolean;

// check if a string is base64 encoded.
isBase64(str: string): boolean;

Expand All @@ -55,6 +58,9 @@ declare namespace validator {
// check if the string is a data uri format (https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs)
isDataURI(str: string): boolean;

// check if the string is a magnet uri format
isMagnetURI(str: string): boolean;

// check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.
isDecimal(str: string): boolean;

Expand Down Expand Up @@ -82,9 +88,16 @@ declare namespace validator {
// check if the string is a hexadecimal number.
isHexadecimal(str: string): boolean;

// check if the string is a valid identity card code.
// locale is one of ['ES', 'zh-TW', 'he-IL'] OR 'any'. If 'any' is used, function will check if any of the locals match.
isIdentityCard(str: string, locale: 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 IP Range (version 4 only).
isIPRange(str: string): boolean;

// check if the string is an ISBN (version 10 or 13).
isISBN(str: string, version?: number): boolean;

Expand All @@ -95,6 +108,9 @@ declare namespace validator {
// check if the string is a valid ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601) date.
isISO8601(str: string): boolean;

// check if the string is a valid RFC 3339 date.
isRFC3339(str: string): boolean;

// check if the string is in a array of allowed values.
isIn(str: string, values: any[]): boolean;

Expand Down