Skip to content

Commit

Permalink
fix(isMobilePhone): enforce stricter Ecuador phone number validation (#…
Browse files Browse the repository at this point in the history
…1191)

* Enforce stricter Ecuador phone number validation

* Add more tests
  • Loading branch information
mmena1 authored and profnandaa committed Nov 5, 2019
1 parent 5907752 commit 5b4a95f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const phones = {
'en-ZA': /^(\+?27|0)\d{9}$/,
'en-ZM': /^(\+?26)?09[567]\d{7}$/,
'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
'es-EC': /^(\+?593|0)[2-7,9]\d{7,8}$/,
'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
'es-PA': /^(\+?507)\d{7,8}$/,
Expand Down
11 changes: 8 additions & 3 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4644,10 +4644,11 @@ describe('Validators', () => {
{
locale: 'es-EC',
valid: [
'+593995414585',
'593912345677',
'0915114585',
'+593987654321',
'593987654321',
'0987654321',
'027332615',
'+59323456789',
],
invalid: [
'03321321',
Expand All @@ -4656,6 +4657,10 @@ describe('Validators', () => {
'02344635',
'593123456789',
'081234567',
'+593912345678',
'+593902345678',
'+593287654321',
'593287654321',
],
},
{
Expand Down

0 comments on commit 5b4a95f

Please sign in to comment.