Skip to content

fix(isPassportNumber): improve US locale #2550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

yitzchak-schechter
Copy link
Contributor

Update isPassportNumber to include new US passport number alphanumeric format

In the Next Generation US Passport, the passport number begins with a letter, followed by eight numbers.

  • Regex updated to support both old and new patterns:
    • Old: 9 digits, /^\d{9}$/
    • New: 1 letter + 8 digits, /^[A-Z]\d{8}$/
    • Combined: /^\d{9}$|^[A-Z]\d{8}$/
  • Added test cases for the new pattern.

Source: Information about the Next Generation U.S. Passport - travel.state.gov

Checklist

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

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (fde5ed5) to head (dd56325).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2550   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2535      2535           
  Branches       641       641           
=========================================
  Hits          2535      2535           

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

@WikiRik WikiRik changed the title fix(isPassportNumber): improve US fix(isPassportNumber): improve US locale Apr 9, 2025
@WikiRik WikiRik requested a review from rubiin April 9, 2025 10:25
@rubiin rubiin merged commit bdb8f9e into validatorjs:master Apr 9, 2025
13 checks passed
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.

3 participants