Skip to content

Commit

Permalink
feat(isMobilePhone): add Maldives dv-MV locale
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Prajwalrajbasnet authored and profnandaa committed Oct 31, 2021
1 parent 5c2d69e commit c96d805
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const phones = {
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
Expand Down
17 changes: 17 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -8343,6 +8343,23 @@ describe('Validators', () => {
'66338855',
],
},
{
locale: 'dv-MV',
valid: [
'+960973256874',
'781246378',
'+960766354789',
'+960912354789',
],
invalid: [
'+96059234567',
'+96045789',
'7812463784',
'+960706985478',
'+960926985478',
'NotANumber',
],
},
];

let allValid = [];
Expand Down

0 comments on commit c96d805

Please sign in to comment.