Skip to content

fix(isMobilePhone): reject pipes in Vietnamese phone numbers - #2950

Open
HASSAN2800 wants to merge 1 commit into
validatorjs:masterfrom
HASSAN2800:fix/vietnamese-mobile-phone-pipe
Open

HASSAN2800 wants to merge 1 commit into
validatorjs:masterfrom
HASSAN2800:fix/vietnamese-mobile-phone-pipe

Conversation

@HASSAN2800

Copy link
Copy Markdown

The Vietnamese mobile number pattern uses [0|6-9], which treats | as a valid character. As a result, isMobilePhone('07|1234567', 'vi-VN') returns true.

Remove the pipe from the character class. Add regression cases for local numbers and both country-code forms, plus valid 076, 077 and 079 numbers.

Validation:

  • The mobile phone test fails on the original code with 07|1234567 and passes with the fix.
  • npm test: 323 passing, including build and lint.
  • Checked the invalid inputs against the generated Node, browser and minified builds.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable): no API or option changes.
  • Tests written (where applicable).
  • References provided in PR (where applicable): the existing pattern and reproduction are shown above.

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9ff3424) to head (9db917e).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2950   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2599      2599           
  Branches       658       658           
=========================================
  Hits          2599      2599           

☔ View full report in Codecov by Harness.
📢 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.

1 participant