Skip to content

Commit 7c2c7d9

Browse files
authored
[@types/validator] update types for release 13.15.0 (DefinitelyTyped#72475)
1 parent 0f35563 commit 7c2c7d9

File tree

11 files changed

+124
-8
lines changed

11 files changed

+124
-8
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../../";
2+
export default validator.isISO15924;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../../";
2+
export default validator.isISO31661Numeric;

types/validator/es/lib/isULID.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../../";
2+
export default validator.isULID;

types/validator/index.d.ts

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,23 @@ declare namespace validator {
581581
*/
582582
export function isHSL(str: string): boolean;
583583

584+
export interface IsRgbColorOptions {
585+
/**
586+
* 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)
587+
*/
588+
includePercentValues?: boolean | undefined;
589+
/**
590+
* `allowSpaces` defaults to `true`, which prohibits whitespace. If set to false, whitespace between color values is allowed, such as `rgb(255, 255, 255)` or even `rgba(255, 128, 0, 0.7)`.
591+
*/
592+
allowSpaces?: boolean | undefined;
593+
}
594+
584595
/**
585596
* Check if the string is a rgb or rgba color.
586597
*
587-
* @param [includePercentValues=true] - 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)
598+
* @param [options] - Options
588599
*/
589-
export function isRgbColor(str: string, includePercentValues?: boolean): boolean;
600+
export function isRgbColor(str: string, options?: IsRgbColorOptions): boolean;
590601

591602
export type IdentityCardLocale =
592603
| "ar-LY"
@@ -599,6 +610,7 @@ declare namespace validator {
599610
| "IT"
600611
| "LK"
601612
| "NO"
613+
| "PK"
602614
| "PL"
603615
| "TH"
604616
| "zh-CN"
@@ -699,13 +711,23 @@ declare namespace validator {
699711
*/
700712
export function isISIN(str: string): boolean;
701713

714+
/**
715+
* Check if the string is a valid [ISO 15924](https://en.wikipedia.org/wiki/ISO_15924) officially assigned script code.
716+
*/
717+
export function isISO15924(str: string): boolean;
718+
702719
export const isISO31661Alpha2: typeof _isISO31661Alpha2.default;
703720

704721
/**
705722
* 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.
706723
*/
707724
export function isISO31661Alpha3(str: string): boolean;
708725

726+
/**
727+
* Check if the string is a valid [ISO 3166-1 numeric](https://en.wikipedia.org/wiki/ISO_3166-1_numeric) officially assigned country code.
728+
*/
729+
export function isISO31661Numeric(str: string): boolean;
730+
709731
/**
710732
* check if the string is a valid [ISO 6346](https://en.wikipedia.org/wiki/ISO_6346) shipping container identification.
711733
* @param str
@@ -802,6 +824,10 @@ declare namespace validator {
802824
* @default undefined
803825
*/
804826
max?: number | undefined;
827+
/**
828+
* @default undefined
829+
*/
830+
discreteLengths?: number | Array<number> | undefined;
805831
}
806832

807833
/**
@@ -818,6 +844,7 @@ declare namespace validator {
818844
| "de-DE"
819845
| "de-LI"
820846
| "en-IN"
847+
| "en-SG"
821848
| "es-AR"
822849
| "hu-HU"
823850
| "pt-BR"
@@ -959,6 +986,7 @@ declare namespace validator {
959986
| "es-HN"
960987
| "es-EC"
961988
| "es-ES"
989+
| "es-GT"
962990
| "es-PE"
963991
| "es-MX"
964992
| "es-PA"
@@ -987,6 +1015,7 @@ declare namespace validator {
9871015
| "ko-KR"
9881016
| "lt-LT"
9891017
| "lv-LV"
1018+
| "mk-MK"
9901019
| "ms-MY"
9911020
| "mz-MZ"
9921021
| "nb-NO"
@@ -1092,6 +1121,7 @@ declare namespace validator {
10921121
| "CA"
10931122
| "CH"
10941123
| "CN"
1124+
| "CO"
10951125
| "CZ"
10961126
| "DE"
10971127
| "DK"
@@ -1212,9 +1242,33 @@ declare namespace validator {
12121242
*/
12131243
export function isUppercase(str: string): boolean;
12141244

1215-
export type UUIDVersion = "1" | "2" | "3" | "4" | "5" | "7" | "all" | 1 | 2 | 3 | 4 | 5 | 7;
12161245
/**
1217-
* Check if the string is a UUID (version 1, 2, 3, 4, 5 or 7).
1246+
* Check if the string is a [ULID](https://github.com/ulid/spec).
1247+
*/
1248+
export function isULID(str: string): boolean;
1249+
1250+
export type UUIDVersion =
1251+
| "1"
1252+
| "2"
1253+
| "3"
1254+
| "4"
1255+
| "5"
1256+
| "6"
1257+
| "7"
1258+
| "8"
1259+
| "nil"
1260+
| "max"
1261+
| "all"
1262+
| 1
1263+
| 2
1264+
| 3
1265+
| 4
1266+
| 5
1267+
| 6
1268+
| 7
1269+
| 8;
1270+
/**
1271+
* Check if the string is a UUID (version 1-8, nil, max, all).
12181272
*
12191273
* @param [version="all"] - UUID version
12201274
*/
@@ -1350,6 +1404,19 @@ declare namespace validator {
13501404
* @default true
13511405
*/
13521406
yahoo_remove_subaddress?: boolean | undefined;
1407+
/**
1408+
* Yandex Mail addresses are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`.
1409+
* Please note that when `all_lowercase` is `true`, Yandex Mail addresses are lowercased regardless of the value of this setting.
1410+
*
1411+
* @default true
1412+
*/
1413+
yandex_lowercase?: boolean | undefined;
1414+
/**
1415+
* All Yandex domains are equal, this explicitly sets the domain to 'yandex.ru'
1416+
*
1417+
* @default true
1418+
*/
1419+
yandex_convert_yandexru?: boolean | undefined;
13531420
/**
13541421
* iCloud addresses (including MobileMe) are known to be case-insensitive, so this switch allows lowercasing them even when `all_lowercase` is set to `false`.
13551422
* Please note that when `all_lowercase` is `true`, iCloud addresses are lowercased regardless of the value of this setting.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../";
2+
export default validator.isISO15924;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../";
2+
export default validator.isISO31661Numeric;

types/validator/lib/isISO4217.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const CurrencyCodes: Set<
4141
| "COP"
4242
| "COU"
4343
| "CRC"
44-
| "CUC"
4544
| "CUP"
4645
| "CVE"
4746
| "CZK"
@@ -65,7 +64,6 @@ export const CurrencyCodes: Set<
6564
| "GYD"
6665
| "HKD"
6766
| "HNL"
68-
| "HRK"
6967
| "HTG"
7068
| "HUF"
7169
| "IDR"
@@ -133,6 +131,7 @@ export const CurrencyCodes: Set<
133131
| "SEK"
134132
| "SGD"
135133
| "SHP"
134+
| "SLE"
136135
| "SLL"
137136
| "SOS"
138137
| "SRD"
@@ -158,6 +157,7 @@ export const CurrencyCodes: Set<
158157
| "UYU"
159158
| "UYW"
160159
| "UZS"
160+
| "VED"
161161
| "VES"
162162
| "VND"
163163
| "VUV"

types/validator/lib/isULID.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import validator from "../";
2+
export default validator.isULID;

types/validator/lib/isURL.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ export interface IsURLOptions {
6767
* @default true
6868
*/
6969
validate_length?: boolean | undefined;
70+
/**
71+
* @default 2084
72+
*/
73+
max_allowed_length?: number | false | undefined;
7074
}

types/validator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/validator",
4-
"version": "13.12.9999",
4+
"version": "13.15.9999",
55
"projects": [
66
"https://github.com/validatorjs/validator.js"
77
],

0 commit comments

Comments
 (0)