-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix autocorrect range #44
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #44 +/- ##
==========================================
+ Coverage 88.32% 88.51% +0.18%
==========================================
Files 39 40 +1
Lines 377 383 +6
Branches 95 95
==========================================
+ Hits 333 339 +6
Misses 44 44
☔ View full report in Codecov by Sentry. |
{ ...firstNameTemplate, line: 2, start: 0, end: 30 }, | ||
].map(createFieldParser); | ||
export default function swissDrivingLicenseFields(lines: string[]) { | ||
const names = lines[2].replace(/^<+|<+$/g, '').split('<<'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very risky as it only works if the line is formatted correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@targos It is acceptable to use "<<" as the delimiter between the first and last name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the parsing should be resilient to lines that don't follow the standard.
- What about lines without any
<<
? - What about lines with multiple names separated by
<<
?
I would prefer not to fundamentally change the parser to accomodate an edge case related to autocorrect only.
Also, this pattern isn't specific to the Swiss driving license. Don't we need similar code changes for other MRZ formats?
Here I propose a fix that doesn't change how the parsing works: #45 |
This solution addresses the problem and enhances error handling flexibility. Thanks! |
No description provided.