Skip to content

Commit

Permalink
feat(isMobilePhone): add support for armenia phone (#1217)
Browse files Browse the repository at this point in the history
* Add support for armenia phone

* Modify regex to support other mobile carriers

closes #1215
  • Loading branch information
Abdullah Danyal authored and profnandaa committed Dec 30, 2019
1 parent 0b9f593 commit ea39867
Show file tree
Hide file tree
Showing 2 changed files with 20 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 @@ -2,6 +2,7 @@ import assertString from './util/assertString';

/* eslint-disable max-len */
const phones = {
'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,
'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/,
'ar-BH': /^(\+?973)?(3|6)\d{7}$/,
'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
Expand Down
19 changes: 19 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -3738,6 +3738,25 @@ describe('Validators', () => {

it('should validate mobile phone number', () => {
let fixtures = [
{
locale: 'am-AM',
valid: [
'+37410324123',
'+37422298765',
'+37431276521',
'022698763',
'37491987654',
'+37494567890',
],
invalid: [
'12345',
'+37411498855',
'+37411498123',
'05614988556',
'',
'37456789000',
],
},
{
locale: 'ar-AE',
valid: [
Expand Down

0 comments on commit ea39867

Please sign in to comment.