feat(isMobilePhone): add support for Croatia (hr-HR) locale#2672
feat(isMobilePhone): add support for Croatia (hr-HR) locale#2672abhu85 wants to merge 2 commits intovalidatorjs:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2672 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2595 2595
Branches 659 659
=========================================
Hits 2595 2595 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add mobile phone validation for Croatia with support for: - Mobile prefixes: 91, 92, 95, 97, 98, 99 - Format: +385 9X XXXXXXX or 09X XXXXXXX (10 digits local, 12 international) Croatian mobile operators: - 91: T-Mobile (Hrvatski Telekom) - 92, 95: A1 Hrvatska - 97, 98, 99: Various operators (Tele2, etc.) References: - https://en.wikipedia.org/wiki/Telephone_numbers_in_Croatia - ITU-T E.164 numbering plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35c1db9 to
363af92
Compare
There was a problem hiding this comment.
Pull request overview
Adds Croatia (hr-HR) locale support to isMobilePhone by introducing a new validation regex, associated test vectors, and documenting the locale in the README locale list.
Changes:
- Add
hr-HRregex tosrc/lib/isMobilePhone.js. - Add
hr-HRvalid/invalid test cases intest/validators.test.js. - Update README
isMobilePhonelocale list to includehr-HR.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/lib/isMobilePhone.js |
Adds hr-HR locale regex to the phones map. |
test/validators.test.js |
Adds a new hr-HR locale block with valid/invalid samples. |
README.md |
Adds hr-HR to the documented isMobilePhone locale list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update regex to support optional spaces (e.g., +385 91 1234567) - Add test cases for space-separated formats - Fix incorrect locale casing in README (am-Am → am-AM, ro-Md → ro-MD)
|
@rubiin I've addressed all the feedback in commit e5ffed2:
All 317 tests pass with 100% coverage. Ready for re-review when you have a moment! |
Summary
Add mobile phone validation support for Croatia (hr-HR locale).
Addresses #1761 (Mobile Phone validations - For The First Time Contributors)
Changes
hr-HRregex pattern toisMobilePhone.jssupporting:+385 9X XXXXXXXor09X XXXXXXX(10 digits local, 12 international)Croatian Mobile Operators
Test Plan
References