Skip to content

Commit

Permalink
Merge pull request #647 from bigwisu/master
Browse files Browse the repository at this point in the history
Indonesian mobile phone
  • Loading branch information
chriso authored Apr 1, 2017
2 parents 51cb474 + c217802 commit 8b83731
Show file tree
Hide file tree
Showing 5 changed files with 36 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 @@ -34,6 +34,7 @@ var phones = {
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\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 @@ -23,6 +23,7 @@ const phones = {
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
Expand Down
32 changes: 32 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,38 @@ describe('Validators', function () {
],
args: ['ro-RO'],
});

test({
validator: 'isMobilePhone',
valid: [
'0217123456',
'0811 778 998',
'089931236181900',
'622178878890',
'62811 778 998',
'62811778998',
'6289931236181900',
'6221 740123456',
'62899 740123456',
'62899 7401 2346',
'0341 8123456',
'0778 89800910',
'0741 123456',
'+6221740123456',
'+62811 778 998',
'+62811778998',
],
invalid: [
'+65740 123 456',
'',
'ASDFGJKLmZXJtZtesting123',
'123456',
'740123456',
'+65640123456',
'+64210123456',
],
args: ['id-ID'],
});
});

it('should validate currency', function () {
Expand Down
1 change: 1 addition & 0 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
Expand Down
Loading

0 comments on commit 8b83731

Please sign in to comment.