feat(isIdentityCard): add NL locale#2338
feat(isIdentityCard): add NL locale#2338RobinvanderVliet wants to merge 7 commits intovalidatorjs:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2338 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2590 2596 +6
Branches 659 659
=========================================
+ Hits 2590 2596 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WikiRik
left a comment
There was a problem hiding this comment.
Not sure about this one, the BSN is comparable to the American Social Security Number, but it's not the document number of Dutch identity cards. We might need to do further review on what the isIdentityCard really validates and possibly change the name so it is clear.
In my view right now we should have three validators; isIdentityCard, isPassportNumber and a third that checks for cases like the BSN and the SSN
I have checked some of the already implemented validator functions in the file, and the validator functions for Finland, Israel, Norway and Spain all seem to check national ID numbers. There might be others that are similar, I have not had time to check them all. Similar to Dutch cards, Norwegian ID cards have the document number on the front side and the national ID number on the reverse side. The Norwegian validator checks the national ID number. |
There was a problem hiding this comment.
Pull request overview
Adds Dutch (NL) support to isIdentityCard by validating BSN numbers (11-proef), with accompanying fixtures and documentation update.
Changes:
- Add
NLlocale implementation tosrc/lib/isIdentityCard.jsusing 11-proef check-digit logic. - Add NL valid/invalid fixtures to
test/validators.test.js. - Document
NLas a supportedisIdentityCardlocale inREADME.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/validators.test.js | Adds NL fixtures to the identity card validator test matrix. |
| src/lib/isIdentityCard.js | Implements NL (BSN/11-proef) validation logic. |
| README.md | Updates isIdentityCard locale list to include NL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add validation to check for zero-only identity card numbers.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I have added a Dutch validation method to
isIdentityCard.References
Checklist