Skip to content

Commit f17e220

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 5b06703 commit f17e220

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/lib/isMobilePhone.js

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const phones = {
7575
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
7676
'es-PA': /^(\+?507)\d{7,8}$/,
7777
'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
78+
'es-SV': /^(\+?503)?[67]\d{7}$/,
7879
'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
7980
'es-VE': /^(\+?58)?(2|4)\d{9}$/,
8081
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,

test/validators.js

+24
Original file line numberDiff line numberDiff line change
@@ -7576,6 +7576,30 @@ describe('Validators', () => {
75767576
'+591993546843',
75777577
],
75787578
},
7579+
{
7580+
locale: 'es-SV',
7581+
valid: [
7582+
'62136634',
7583+
'50361366631',
7584+
'+50361366634',
7585+
'+50361367217',
7586+
'+50361367460',
7587+
'+50371367632',
7588+
'+50371367767',
7589+
'+50371368314',
7590+
],
7591+
invalid: [
7592+
'+5032136663',
7593+
'21346663',
7594+
'+50321366663',
7595+
'12345',
7596+
'El salvador',
7597+
'this should fail',
7598+
'+5032222',
7599+
'+503 1111 1111',
7600+
'00 +503 1234 5678',
7601+
],
7602+
},
75797603
{
75807604
locale: 'es-UY',
75817605
valid: [

0 commit comments

Comments
 (0)