Skip to content

Commit 3c077d4

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 0d19266 commit 3c077d4

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
@@ -7514,6 +7514,30 @@ describe('Validators', () => {
75147514
'+591993546843',
75157515
],
75167516
},
7517+
{
7518+
locale: 'es-SV',
7519+
valid: [
7520+
'62136634',
7521+
'50361366631',
7522+
'+50361366634',
7523+
'+50361367217',
7524+
'+50361367460',
7525+
'+50371367632',
7526+
'+50371367767',
7527+
'+50371368314',
7528+
],
7529+
invalid: [
7530+
'+5032136663',
7531+
'21346663',
7532+
'+50321366663',
7533+
'12345',
7534+
'El salvador',
7535+
'this should fail',
7536+
'+5032222',
7537+
'+503 1111 1111',
7538+
'00 +503 1234 5678',
7539+
],
7540+
},
75177541
{
75187542
locale: 'es-UY',
75197543
valid: [

0 commit comments

Comments
 (0)