Skip to content

Commit

Permalink
feat(isMobilePhone): add libya locale (#1294)
Browse files Browse the repository at this point in the history
closes #1290
  • Loading branch information
almelyan-ly authored May 25, 2020
1 parent be34383 commit 8db3877
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var phones = {
'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/,
'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
'ar-KW': /^(\+?965)[569]\d{7}$/,
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
'ar-TN': /^(\+?216)?[2459]\d{7}$/,
Expand Down
1 change: 1 addition & 0 deletions src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const phones = {
'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/,
'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
'ar-KW': /^(\+?965)[569]\d{7}$/,
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
'ar-TN': /^(\+?216)?[2459]\d{7}$/,
Expand Down
25 changes: 25 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4720,6 +4720,31 @@ describe('Validators', () => {
'0114152198',
],
},
{
locale: 'ar-LY',
valid: [
'912220000',
'0923330000',
'218945550000',
'+218958880000',
'212220000',
'0212220000',
'+218212220000',
],
invalid: [
'9122220000',
'00912220000',
'09211110000',
'+0921110000',
'+2180921110000',
'021222200000',
'213333444444',
'',
'+212234',
'+21',
'02122333',
],
},
{
locale: 'ar-SY',
valid: [
Expand Down
1 change: 1 addition & 0 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,7 @@ var ibanRegexThroughCountryCode = {
LT: /^(LT[0-9]{2})\d{16}$/,
LU: /^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/,
LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,
LY: /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,
MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/,
ME: /^(ME[0-9]{2})\d{18}$/,
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit 8db3877

Please sign in to comment.