Repository navigation
fix(isPassportNumber): accept South Korea's next-generation passport numbers - #2962
Open
wonjangcloud9 wants to merge 1 commit into
Open
wonjangcloud9 wants to merge 1 commit into
wonjangcloud9 wants to merge 1 commit into
Conversation
…numbers Since 21 December 2021 Korea issues next-generation passports whose number puts a letter in the fifth position (M123A4567 instead of M12345678). The KR pattern only allowed eight digits after the type letter, so every passport issued since then was rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2962 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2599 2599
Branches 658 658
=========================================
Hits 2599 2599 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 21 December 2021, South Korea has issued next-generation passports whose numbers put a letter in the fifth position:
M123A4567instead ofM12345678. TheKRpattern only allowed eight digits after the type letter, soisPassportNumberrejected every Korean passport issued since then.This PR keeps the old form and adds the new one:
/^[MS](\d{8}|\d{3}[A-Z]\d{4})$/.Checked against the published build (
require('./index.js')):masterM12345678(old format)M123A4567(new format, the government's own example)m123a4567(lowercase; the input is upper-cased before matching)S456B7890M1234A567(letter in the wrong place)M123A456(too short)X123A4567(unknown type letter)The new cases in
test/validators.test.jsfail onmasterwithvalidator.isPassportNumber("M123A4567", "KR") failed but should have passedand pass with the fix. The fullnpm test(build, lint, Mocha) passes: 323 passing.Scope: I kept the existing
M/Stype letters. Microsoft's definition also listsR,OandD(residence, official and diplomatic passports). That is a separate change, so I left it out.References
M12345678→M123A4567, "영문자 1자리 추가" ("one letter added"). https://www.gangnam.go.kr/contents/center_minwon/1/view.do?mid=ID03_030701Checklist
🤖 Generated with Claude Code