From 7fcb3eb3a594e12f06f4f3fab1b96396db384e45 Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:11:07 +0530 Subject: [PATCH 1/6] fix(isRgbColor): allow arbitrary decimal digits for alpha values and trailing zeros on 1 --- src/lib/isRgbColor.js | 4 ++-- test/validators.test.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/isRgbColor.js b/src/lib/isRgbColor.js index a672df279..c8272a05c 100644 --- a/src/lib/isRgbColor.js +++ b/src/lib/isRgbColor.js @@ -2,9 +2,9 @@ import assertString from './util/assertString'; const rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/; -const rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; +const rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0(\.\d+)?|1(\.0+)?|\.\d+)\)$/; const rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/; -const rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; +const rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0(\.\d+)?|1(\.0+)?|\.\d+)\)$/; const startsWithRgb = /^rgba?/; export default function isRgbColor(str, options) { diff --git a/test/validators.test.js b/test/validators.test.js index 9c867efae..eadbfe79b 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -5122,6 +5122,10 @@ describe('Validators', () => { 'rgb(5%,5%,5%)', 'rgba(5%,5%,5%,.3)', 'rgba(5%,5%,5%,.32)', + 'rgba(255,255,255,.123)', + 'rgba(5%,5%,5%,.321)', + 'rgba(0,0,0,1.00)', + 'rgba(0,0,0,0.12345)', ], invalid: [ 'rgb(0,0,0,)', @@ -5130,12 +5134,10 @@ describe('Validators', () => { 'rgb()', 'rgba(0,0,0)', 'rgba(255,255,255,2)', - 'rgba(255,255,255,.123)', 'rgba(255,255,256,0.1)', 'rgb(4,4,5%)', 'rgba(5%,5%,5%)', 'rgba(3,3,3%,.3)', - 'rgba(5%,5%,5%,.321)', 'rgb(101%,101%,101%)', 'rgba(3%,3%,101%,0.3)', 'rgb(101%,101%,101%) additional invalid string part', From 55be03520a8aaad8c5c794e79c8035d791862108 Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:13:31 +0530 Subject: [PATCH 2/6] fix(normalizeEmail): correct typo Conversts -> Converts in comment --- src/lib/normalizeEmail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/normalizeEmail.js b/src/lib/normalizeEmail.js index ceb252f34..f4349ac1e 100644 --- a/src/lib/normalizeEmail.js +++ b/src/lib/normalizeEmail.js @@ -14,7 +14,7 @@ const default_normalize_email_options = { gmail_remove_dots: true, // Removes the subaddress (e.g. "+foo") from the email address gmail_remove_subaddress: true, - // Conversts the googlemail.com domain to gmail.com + // Converts the googlemail.com domain to gmail.com gmail_convert_googlemaildotcom: true, // The following conversions are specific to Outlook.com / Windows Live / Hotmail From 3c1354cd4d642696263236ac60a3a9b2786fa8dc Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:16:43 +0530 Subject: [PATCH 3/6] fix(isISO6346): fix regex anchoring and character set comma bug --- src/lib/isISO6346.js | 2 +- test/validators.test.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/isISO6346.js b/src/lib/isISO6346.js index 2c28c1123..cb6ac7b32 100644 --- a/src/lib/isISO6346.js +++ b/src/lib/isISO6346.js @@ -3,7 +3,7 @@ import assertString from './util/assertString'; // https://en.wikipedia.org/wiki/ISO_6346 // according to ISO6346 standard, checksum digit is mandatory for freight container but recommended // for other container types (J and Z) -const isISO6346Str = /^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/; +const isISO6346Str = /^[A-Z]{3}(U[0-9]{7}|[JZ][0-9]{6,7})$/; const isDigit = /^[0-9]$/; export function isISO6346(str) { diff --git a/test/validators.test.js b/test/validators.test.js index eadbfe79b..ddcb811f1 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -13544,6 +13544,11 @@ describe('Validators', () => { 'ECMJ4657496', 'TBJA7176445', 'AFFU5962593', + 'abcHLXU2008419', + 'HLXU2008419abc', + 'abcQJRZ123456', + 'QJRZ123456abc', + 'QJR,123456', ], }); }); @@ -13569,6 +13574,11 @@ describe('Validators', () => { 'ECMJ4657496', 'TBJA7176445', 'AFFU5962593', + 'abcHLXU2008419', + 'HLXU2008419abc', + 'abcQJRZ123456', + 'QJRZ123456abc', + 'QJR,123456', ], }); }); From cfa6771b2961ff75ccb802ef4a54239fdfcf5106 Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:20:45 +0530 Subject: [PATCH 4/6] docs(isMobilePhone): update supported locales list in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ef42fd79..4b74a048f 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ Validator | Description **isMailtoURI(str, [, options])** | check if the string is a [Mailto URI format][Mailto URI Format].

`options` is an object of validating emails inside the URI (check `isEmail`s options for details). **isMD5(str)** | check if the string is a MD5 hash.

Please note that you can also use the `isHash(str, 'md5')` function. Keep in mind that MD5 has some collision weaknesses compared to other algorithms (e.g., SHA). **isMimeType(str)** | check if the string matches to a valid [MIME type][MIME Type] format. -**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,

`locale` is either an array of locales (e.g. `['sk-SK', 'sr-RS']`) OR one of `['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-EH', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-PS', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'az-AZ', 'az-LB', 'az-LY', 'be-BY', 'bg-BG', 'bn-BD', 'bs-BA', 'ca-AD', 'cs-CZ', 'da-DK', 'de-AT', 'de-CH', 'de-DE', 'de-LU', 'dv-MV', 'dz-BT', 'el-CY', 'el-GR', 'en-AG', 'en-AI', 'en-AU', 'en-BM', 'en-BS', 'en-BW', 'en-CA', 'en-CM', 'en-GB', 'en-GG', 'en-GH', 'en-GY', 'en-HK', 'en-IE', 'en-IN', 'en-JM', 'en-KE', 'en-KI', 'en-KN', 'en-LS', 'en-MO', 'en-MT', 'en-MU', 'en-MW', 'en-NG', 'en-NZ', 'en-PG', 'en-PH', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-SS', 'en-TZ', 'en-UG', 'en-US', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-CU', 'es-DO', 'es-EC', 'es-ES', 'es-GT', 'es-HN', 'es-MX', 'es-NI', 'es-PA', 'es-PE', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et-EE', 'fa-AF', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-BF', 'fr-BJ', 'fr-CD', 'fr-CF', 'fr-DJ', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', 'fr-RE', 'fr-WF', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'ir-IR', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'ky-KG', 'lt-LT', 'mg-MG', 'mn-MN', 'mk-MK', 'ms-MY', 'my-MM', 'mz-MZ', 'nb-NO', 'ne-NP', 'nl-AW', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-AO', 'pt-BR', 'pt-PT', 'ro-Md', 'ro-RO', 'ru-RU', 'si-LK', 'sk-SK', 'sl-SI', 'so-SO', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tk-TM', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW']` OR defaults to `'any'`. If 'any' or a falsey value is used, function will check if any of the locales match).

`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`. Locale list is `validator.isMobilePhoneLocales`. +**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,

`locale` is either an array of locales (e.g. `['sk-SK', 'sr-RS']`) OR one of `['am-AM', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-EH', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-OM', 'ar-PS', 'ar-QA', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'az-AZ', 'be-BY', 'bg-BG', 'bn-BD', 'bs-BA', 'ca-AD', 'cs-CZ', 'da-DK', 'de-AT', 'de-CH', 'de-DE', 'de-LU', 'dv-MV', 'dz-BT', 'el-CY', 'el-GR', 'en-AG', 'en-AI', 'en-AU', 'en-BM', 'en-BS', 'en-BW', 'en-CA', 'en-CM', 'en-GB', 'en-GG', 'en-GH', 'en-GY', 'en-HK', 'en-IE', 'en-IN', 'en-JM', 'en-KE', 'en-KI', 'en-KN', 'en-LS', 'en-MO', 'en-MT', 'en-MU', 'en-MW', 'en-NA', 'en-NG', 'en-NZ', 'en-PG', 'en-PH', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-SS', 'en-TZ', 'en-UG', 'en-US', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-CU', 'es-DO', 'es-EC', 'es-ES', 'es-GT', 'es-HN', 'es-MX', 'es-NI', 'es-PA', 'es-PE', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et-EE', 'fa-AF', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-BF', 'fr-BJ', 'fr-CA', 'fr-CD', 'fr-CF', 'fr-CH', 'fr-CM', 'fr-DJ', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', 'fr-RE', 'fr-WF', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'ir-IR', 'it-CH', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'ky-KG', 'lt-LT', 'lv-LV', 'mg-MG', 'mk-MK', 'mn-MN', 'ms-MY', 'my-MM', 'mz-MZ', 'nb-NO', 'ne-NP', 'nl-AW', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-AO', 'pt-BR', 'pt-PT', 'ro-MD', 'ro-RO', 'ru-RU', 'si-LK', 'sk-SK', 'sl-SI', 'so-SO', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tk-TM', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW']` OR defaults to `'any'`. If 'any' or a falsey value is used, function will check if any of the locales match).

`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`. Locale list is `validator.isMobilePhoneLocales`. **isMongoId(str)** | check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid]. **isMultibyte(str)** | check if the string contains one or more multibyte chars. **isNumeric(str [, options])** | check if the string contains only numbers.

`options` is an object which defaults to `{ no_symbols: false }` it also has `locale` as an option. If `no_symbols` is true, the validator will reject numeric strings that feature a symbol (e.g. `+`, `-`, or `.`).

`locale` determines the decimal separator and 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', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'eo', 'es-ES', 'fr-FR', 'fr-CA', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`. From f5bf121e7aa47985a57c22a2678ff81bbbf4f581 Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:24:17 +0530 Subject: [PATCH 5/6] fix(isCreditCard): fix Mastercard regex anchoring and digit length check --- src/lib/isCreditCard.js | 2 +- test/validators.test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/isCreditCard.js b/src/lib/isCreditCard.js index 938679d39..5a5b34b17 100644 --- a/src/lib/isCreditCard.js +++ b/src/lib/isCreditCard.js @@ -6,7 +6,7 @@ const cards = { dinersclub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/, discover: /^6(?:011|5[0-9][0-9])[0-9]{12,15}$/, jcb: /^(?:2131|1800|35\d{3})\d{11}$/, - mastercard: /^5[1-5][0-9]{2}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/, // /^[25][1-7][0-9]{14}$/; + mastercard: /^(?:5[1-5][0-9]{14}|(?:222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12})$/, unionpay: /^(6[27][0-9]{14}|^(81[0-9]{14,17}))$/, visa: /^(?:4[0-9]{12})(?:[0-9]{3,6})?$/, }; diff --git a/test/validators.test.js b/test/validators.test.js index ddcb811f1..14d7439e1 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -6598,6 +6598,11 @@ describe('Validators', () => { '6765780016990268', '8171999927660000', '8171999900000000021', + '5108', + 'foo2222155765072228', + '2222155765072228foo', + '51080000000000', + '51080000000000000', ], }); }); From 5c6bec40ce556eae911202f399f75b6c226af214 Mon Sep 17 00:00:00 2001 From: SarthakDudhe Date: Wed, 1 Jul 2026 13:27:27 +0530 Subject: [PATCH 6/6] fix(isMobilePhone): add carrier codes 33, 77, 78 for uz-UZ locale --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 32379bde5..3e982909e 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -154,7 +154,7 @@ const phones = { 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'tk-TM': /^(\+993|993|8)\d{8}$/, 'uk-UA': /^(\+?38)?0(50|6[36-8]|7[357]|9[1-9])\d{7}$/, - 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, + 'uz-UZ': /^(\+?998)?(33|6[125-79]|7[1-9]|88|9\d)\d{7}$/, 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/, diff --git a/test/validators.test.js b/test/validators.test.js index 14d7439e1..70a1b8cb9 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10439,6 +10439,12 @@ describe('Validators', () => { '+998957124555', '998957124555', '957124555', + '+998770178734', + '770178734', + '+998331234567', + '331234567', + '+998781234567', + '781234567', ], invalid: [ '+998644835244',