Skip to content

Commit

Permalink
fix(isMobile): allow for extra formatting for ja-JP locale (#1166)
Browse files Browse the repository at this point in the history
* WIP: modified ja-JP check.

* WIP: added test cases.

* Added one more invalid test case.
  • Loading branch information
ayala-io authored and profnandaa committed Oct 18, 2019
1 parent 2222e5a commit 659a758
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Expand Up @@ -59,7 +59,7 @@ const phones = {
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
Expand Down
8 changes: 8 additions & 0 deletions test/validators.js
Expand Up @@ -4929,6 +4929,10 @@ describe('Validators', () => {
'06012345678',
'090 1234 5678',
'+8190-1234-5678',
'+81 (0)90-1234-5678',
'+819012345678',
'+81-(0)90-1234-5678',
'+81 90 1234 5678',
],
invalid: [
'12345',
Expand All @@ -4949,6 +4953,10 @@ describe('Validators', () => {
'03-1234-5678',
'+81312345678',
'+816-1234-5678',
'+81 090 1234 5678',
'+8109012345678',
'+81-090-1234-5678',
'90 1234 5678',
],
},
{
Expand Down

0 comments on commit 659a758

Please sign in to comment.