From 6efee732be30ceca6c45532c3f6c955645cddcde Mon Sep 17 00:00:00 2001 From: Wisu Suntoyo Date: Tue, 23 Oct 2018 09:57:45 +0700 Subject: [PATCH] Indonesian mobile operators 2018 --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 59 ++++++++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 9594d8b70..26ea54526 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -43,7 +43,7 @@ const phones = { 'fr-FR': /^(\+?33|0)[67]\d{8}$/, 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, - 'id-ID': /^(\+?62|0)(0?8?\d\d\s?\d?)([\s?|\d]{7,12})$/, + '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)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/, 'kk-KZ': /^(\+?7|8)?7\d{9}$/, diff --git a/test/validators.js b/test/validators.js index 7d2c63e1f..888492a38 100644 --- a/test/validators.js +++ b/test/validators.js @@ -4335,20 +4335,53 @@ describe('Validators', () => { { locale: 'id-ID', valid: [ - '0217123456', '0811 778 998', + '0811 7785 9983', + '0812 7784 9984', + '0813 7782 9982', + '0821 1234 1234', + '0822 1234 1234', + '0823 1234 1234', + '0852 1234 6764', + '0853 1234 6764', + '0851 1234 6764', + '0814 7782 9982', + '0815 7782 9982', + '0816 7782 9982', + '0855 7782 9982', + '0856 7782 9982', + '0857 7782 9982', + '0858 7782 9982', + '0817 7785 9983', + '0818 7784 9984', + '0819 7782 9982', + '0859 1234 1234', + '0877 1234 1234', + '0878 1234 1234', + '0895 7785 9983', + '0896 7784 9984', + '0897 7782 9982', + '0898 1234 1234', + '0899 1234 1234', + '0881 7785 9983', + '0882 7784 9984', + '0883 7782 9982', + '0884 1234 1234', + '0886 1234 1234', + '0887 1234 1234', + '0888 7785 9983', + '0889 7784 9984', + '0828 7784 9984', + '0838 7784 9984', + '0831 7784 9984', + '0832 7784 9984', + '0833 7784 9984', '089931236181900', - '622178878890', '62811 778 998', '62811778998', - '6289931236181900', - '6221 740123456', - '62899 740123456', + '628993123618190', + '62898 740123456', '62899 7401 2346', - '0341 8123456', - '0778 89800910', - '0741 123456', - '+6221740123456', '+62811 778 998', '+62811778998', '+62812 9650 3508', @@ -4357,6 +4390,14 @@ describe('Validators', () => { '+62811787391', ], invalid: [ + '0899312361819001', + '0217123456', + '622178878890', + '6221 740123456', + '0341 8123456', + '0778 89800910', + '0741 123456', + '+6221740123456', '+65740 123 456', '', 'ASDFGJKLmZXJtZtesting123',