Skip to content

fix(isPassportNumber): update Mexico passport formats#2719

Open
leno23 wants to merge 1 commit into
validatorjs:masterfrom
leno23:fix/mx-passport-number-2641
Open

fix(isPassportNumber): update Mexico passport formats#2719
leno23 wants to merge 1 commit into
validatorjs:masterfrom
leno23:fix/mx-passport-number-2641

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

  • Updates the Mexico (MX) passport regex to accept both legacy and current formats
  • Legacy: one letter followed by 7–8 digits (e.g. J0000001, J00000001)
  • Current: one letter followed by 8 alphanumeric characters (e.g. G20693408, A1B2C3D4E)

Example

isPassportNumber('J00000001', 'MX'); // true (legacy)
isPassportNumber('G20693408', 'MX'); // true (current)
isPassportNumber('123456789', 'MX'); // false (all digits)

Closes #2641

Test plan

  • npm test passes
  • Added MX valid/invalid cases in test/validators.test.js

Made with Cursor

Closes validatorjs#2641

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7fdc788) to head (a93bcc7).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2719   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2587      2587           
  Branches       656       656           
=========================================
  Hits          2587      2587           

☔ 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.

Mexico passport number validation incorrect

1 participant