Skip to content

fix(isPassportNumber): support case-insensitive country codes#2821

Open
smoelius wants to merge 1 commit into
validatorjs:masterfrom
trail-of-forks:fix-isPassportNumber
Open

fix(isPassportNumber): support case-insensitive country codes#2821
smoelius wants to merge 1 commit into
validatorjs:masterfrom
trail-of-forks:fix-isPassportNumber

Conversation

@smoelius

Copy link
Copy Markdown

fix(isPassportNumber): support case-insensitive country codes

This PR fixes a TypeError in isPassportNumber when a lowercase or mixed-case country code is provided.

Previously, the validator checked the normalized uppercase country code but accessed the passport regex map using the original country code. The country code is now normalized once and used consistently for both operations.

Regression tests cover lowercase (am) and mixed-case (aM) country codes with valid and invalid Armenian passport numbers.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

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

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

☔ 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