-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
isMobilePhone - fixed validation for am-AM #2140
Changes from 7 commits
78c73cb
98b9fdf
9b2aa48
043eba1
680b016
374dbb0
4bf31c5
ce55c93
158489b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ import assertString from './util/assertString'; | |||||
|
||||||
/* eslint-disable max-len */ | ||||||
const phones = { | ||||||
'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/, | ||||||
'am-AM': /^(\+?374|0)(1[0125][2-9]|22[2346]|23[1-7]|24[2-69]|25[2-7]|26[1-9]|28[13-7]|3[12]2|(33|4[134]|55|77|88|9[13-689])\d)\d{5}$/, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're still validating fixed phone numbers in this RegExp. See the section for 'Non-geographic number for mobile services' on page 12 for the only mobile phone numbers; https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200000A0007PDFE.pdf
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WikiRik, |
||||||
'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/, | ||||||
'ar-BH': /^(\+?973)?(3|6)\d{7}$/, | ||||||
'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6458,14 +6458,23 @@ describe('Validators', () => { | |
'022698763', | ||
'37491987654', | ||
'+37494567890', | ||
'+37455123456', | ||
'+37477123456', | ||
'+37488123456', | ||
'+37411498855', | ||
'+37411498123', | ||
], | ||
invalid: [ | ||
'12345', | ||
'+37411498855', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is sort of minor "breaking change", can you move the removed test-cases to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
'+37411498123', | ||
'+37403498855', | ||
'+37416498123', | ||
'05614988556', | ||
'', | ||
'37456789000', | ||
'37486789000', | ||
'+37431312345', | ||
'+37430312345', | ||
'+37460123456', | ||
], | ||
}, | ||
{ | ||
|
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.
nit: wondering if this regex could be any simpler?
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.
I don't think, I did all my best to combine and simplify similar parts.