Skip to content

Commit

Permalink
fix(isMobilePhone): allow spaces in Hong Kong and Macau phone numbers (
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Ivanov authored and profnandaa committed Dec 10, 2019
1 parent 549cbec commit 0b9f593
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const phones = {
'en-GB': /^(\+?44|0)7\d{9}$/,
'en-GG': /^(\+?44|0)1481\d{6}$/,
'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,
'en-HK': /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,
'en-MO': /^(\+?853\-?)?[268]\d{3}\-?\d{4}$/,
'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
Expand Down
7 changes: 7 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4193,6 +4193,8 @@ describe('Validators', () => {
'+85291234567',
'+852-91234567',
'+852-9123-4567',
'+852 9123 4567',
'9123 4567',
'852-91234567',
],
invalid: [
Expand All @@ -4209,15 +4211,20 @@ describe('Validators', () => {
'+85361234567',
'+853-61234567',
'+853-6123-4567',
'+853 6123 4567',
'6123 4567',
'853-61234567',
],
invalid: [
'999',
'12345678',
'612345678',
'+853-12345678',
'+853-22345678',
'+853-82345678',
'+853-612345678',
'+853-1234-5678',
'+853 1234 5678',
'+853-6123-45678',
],
},
Expand Down

0 comments on commit 0b9f593

Please sign in to comment.