Skip to content

Commit a6c787a

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 12b159d commit a6c787a

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/lib/isMobilePhone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const phones = {
7373
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
7474
'es-PA': /^(\+?507)\d{7,8}$/,
7575
'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
76+
'es-SV': /^(\+?503)?[67]\d{7}$/,
7677
'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
7778
'es-VE': /^(\+?58)?(2|4)\d{9}$/,
7879
'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
@@ -7530,6 +7530,30 @@ describe('Validators', () => {
75307530
'+591993546843',
75317531
],
75327532
},
7533+
{
7534+
locale: 'es-SV',
7535+
valid: [
7536+
'62136634',
7537+
'50361366631',
7538+
'+50361366634',
7539+
'+50361367217',
7540+
'+50361367460',
7541+
'+50371367632',
7542+
'+50371367767',
7543+
'+50371368314',
7544+
],
7545+
invalid: [
7546+
'+5032136663',
7547+
'21346663',
7548+
'+50321366663',
7549+
'12345',
7550+
'El salvador',
7551+
'this should fail',
7552+
'+5032222',
7553+
'+503 1111 1111',
7554+
'00 +503 1234 5678',
7555+
],
7556+
},
75337557
{
75347558
locale: 'es-UY',
75357559
valid: [

0 commit comments

Comments
 (0)