Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isMobilePhone - fixed validation for am-AM #2140

Merged
merged 9 commits into from
Apr 25, 2024
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +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}$)/,
'am-AM': /^(\+?374|0)(33|4[134]|55|77|88|9[13-689])\d{6}$/,
'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
35 changes: 27 additions & 8 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6631,20 +6631,39 @@ describe('Validators', () => {
{
locale: 'am-AM',
valid: [
'+37410324123',
'+37422298765',
'+37431276521',
'022698763',
'37491987654',
'+37494567890',
'+37433123456',
'+37441123456',
'+37443123456',
'+37444123456',
'+37455123456',
'+37477123456',
'+37488123456',
'+37491123456',
'+37493123456',
'+37494123456',
'+37495123456',
'+37496123456',
'+37498123456',
'+37499123456',
'055123456',
'37455123456',
],
invalid: [
'12345',
'+37411498855',
'+37411498123',
'+37403498855',
'+37416498123',
'05614988556',
'',
'37456789000',
'37486789000',
'+37431312345',
'+37430312345',
'+37460123456',
'+37410324123',
'+37422298765',
'+37431276521',
'022698763',
'+37492123456',
],
},
{
Expand Down