Skip to content

fix(isMobilePhone): add missing Uzbekistan carrier codes 33, 55, and 77#2725

Open
xxiaoxiong wants to merge 7 commits into
validatorjs:masterfrom
xxiaoxiong:fix/uzbekistan-mobile-phone-codes
Open

fix(isMobilePhone): add missing Uzbekistan carrier codes 33, 55, and 77#2725
xxiaoxiong wants to merge 7 commits into
validatorjs:masterfrom
xxiaoxiong:fix/uzbekistan-mobile-phone-codes

Conversation

@xxiaoxiong
Copy link
Copy Markdown

@xxiaoxiong xxiaoxiong commented May 28, 2026

Problem

Valid Uzbekistan mobile numbers using the newer carrier codes (33, 55, 77) are incorrectly rejected by isMobilePhone. A number like +99833...8734 should be valid but returns false.

Changes

  • src/lib/isMobilePhone.js: Added prefixes 33, 55, and 77 to the uz-UZ locale regex pattern
  • test/validators.test.js: Added test cases for the newly supported prefixes

Why

These prefixes are officially assigned by the Uzbekistan Communications Agency to Humans (33) and Ucell (55, 77). Without them, valid active mobile numbers are rejected.

Closes #2683

The isJWT function currently only validates that the JWT has three
dot-separated segments and that each segment is valid URL-safe base64.
However, it does not verify that the decoded header and payload are valid
JSON. This allows strings like `foo.bar.dGVzdA` to pass validation
even though they are not valid JWTs.

This fix decodes the base64-encoded header and payload and checks that
they parse as valid JSON before returning true.

Fixes validatorjs#2511
The `isMobilePhone` function for `uz-UZ` locale was missing newer
carrier codes 33 (Humans), 55, and 77 (Ucell). A valid number like
`+998770178734` was incorrectly rejected.

This adds the missing prefixes to the regex pattern and includes
corresponding test cases.

Closes validatorjs#2683
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.80%. Comparing base (7fdc788) to head (a9433ef).

Files with missing lines Patch % Lines
src/lib/isJWT.js 73.68% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            master    #2725      +/-   ##
===========================================
- Coverage   100.00%   99.80%   -0.20%     
===========================================
  Files          114      114              
  Lines         2587     2605      +18     
  Branches       656      660       +4     
===========================================
+ Hits          2587     2600      +13     
- Misses           0        4       +4     
- Partials         0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isMobilePhone('uz-UZ') returns false for valid Uzbekistan carrier codes (e.g., 77)

1 participant