Skip to content

Commit

Permalink
update src/lib and fix mobile phone id-ID test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigwisu committed Apr 1, 2017
1 parent 4d9308c commit c217802
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 33 deletions.
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
64 changes: 32 additions & 32 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -2805,39 +2805,39 @@ 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'],

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 () {
test({
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 c217802

Please sign in to comment.