Skip to content

Commit c96d805

Browse files
beprajwalprofnandaa
authored andcommitted
feat(isMobilePhone): add Maldives dv-MV locale
chore: squashed #1829 Add locale for Maldives in mobile phone validator Add tests for mobile numbers validation of maldives locale i.e. dv-MV Update readme to add Maldives locale (dv-MV) in isMobilePhone documentation
1 parent 5c2d69e commit c96d805

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const phones = {
2929
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
3030
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
3131
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
32+
'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
3233
'el-GR': /^(\+?30|0)?(69\d{8})$/,
3334
'en-AU': /^(\+?61|0)4\d{8}$/,
3435
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,

test/validators.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8343,6 +8343,23 @@ describe('Validators', () => {
83438343
'66338855',
83448344
],
83458345
},
8346+
{
8347+
locale: 'dv-MV',
8348+
valid: [
8349+
'+960973256874',
8350+
'781246378',
8351+
'+960766354789',
8352+
'+960912354789',
8353+
],
8354+
invalid: [
8355+
'+96059234567',
8356+
'+96045789',
8357+
'7812463784',
8358+
'+960706985478',
8359+
'+960926985478',
8360+
'NotANumber',
8361+
],
8362+
},
83468363
];
83478364

83488365
let allValid = [];

0 commit comments

Comments
 (0)