Skip to content

Commit 250339c

Browse files
herejeprofnandaa
authored andcommitted
feat(isMobilePhone): add El Salvador es-SV locale
* Solve issue with wrong validation on El Salvador mobile phones * update tests accordingly in order to define the right regEx, the following site was consulted. https://www.siget.gob.sv/guia-de-servicios/consulta-el-plan-de-numeracion/numeros-moviles/
1 parent 3a524ce commit 250339c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const phones = {
7272
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
7373
'es-PA': /^(\+?507)\d{7,8}$/,
7474
'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
75+
'es-SV': /^(\+?503)?[67]\d{7}$/,
7576
'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
7677
'es-VE': /^(\+?58)?(2|4)\d{9}$/,
7778
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,

test/validators.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7492,6 +7492,30 @@ describe('Validators', () => {
74927492
'+591993546843',
74937493
],
74947494
},
7495+
{
7496+
locale: 'es-SV',
7497+
valid: [
7498+
'62136634',
7499+
'50361366631',
7500+
'+50361366634',
7501+
'+50361367217',
7502+
'+50361367460',
7503+
'+50371367632',
7504+
'+50371367767',
7505+
'+50371368314',
7506+
],
7507+
invalid: [
7508+
'+5032136663',
7509+
'21346663',
7510+
'+50321366663',
7511+
'12345',
7512+
'El salvador',
7513+
'this should fail',
7514+
'+5032222',
7515+
'+503 1111 1111',
7516+
'00 +503 1234 5678',
7517+
],
7518+
},
74957519
{
74967520
locale: 'es-UY',
74977521
valid: [

0 commit comments

Comments
 (0)