fix(isPassportNumber): improve `US` locale by yitzchak-schechter · Pull Request #2550 · validatorjs/validator.js
Navigation Menu
{{ message }}
validatorjs / validator.js Public
- Notifications You must be signed in to change notification settings
- Fork 2.4k
Merged
rubiin merged 1 commit intovalidatorjs:masterfrom
Apr 9, 2025Merged
fix(isPassportNumber): improve US locale#2550
rubiin merged 1 commit intovalidatorjs:masterfrom
fix(isPassportNumber): improve US locale#2550
rubiin merged 1 commit intovalidatorjs:masterfrom
Conversation
Copy link Copy Markdown
Contributor
yitzchak-schechter
commented
Apr 9, 2025
yitzchak-schechter
commented
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}$/
- Old: 9 digits,
- 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 Copy Markdown
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
changed the title
fix(isPassportNumber): improve
fix(isPassportNumber): improve USUS locale
WikiRik approved these changes Apr 9, 2025
WikiRik
requested a review
from rubiin
rubiin approved these changes Apr 9, 2025
WikiRik
mentioned this pull request
fossabot
bot
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment