Skip to content

Commit 556f54f

Browse files
Idris Akmal Haslinchriso
Idris Akmal Haslin
authored andcommittedDec 23, 2018
fix(isMobilePhone): update ms-MY locale (#950)
* Added a digit 0 for malaysian phone number prefix * Added test for MY numbers, should be good now
1 parent 52f7673 commit 556f54f

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed
 

‎lib/isMobilePhone.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var phones = {
6262
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
6363
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
6464
'lt-LT': /^(\+370|8)\d{8}$/,
65-
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
65+
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
6666
'nb-NO': /^(\+?47)?[49]\d{7}$/,
6767
'nl-BE': /^(\+?32|0)4?\d{8}$/,
6868
'nn-NO': /^(\+?47)?[49]\d{7}$/,

‎src/lib/isMobilePhone.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const phones = {
5252
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
5353
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
5454
'lt-LT': /^(\+370|8)\d{8}$/,
55-
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
55+
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
5656
'nb-NO': /^(\+?47)?[49]\d{7}$/,
5757
'nl-BE': /^(\+?32|0)4?\d{8}$/,
5858
'nn-NO': /^(\+?47)?[49]\d{7}$/,

‎test/validators.js

+4
Original file line numberDiff line numberDiff line change
@@ -4238,8 +4238,12 @@ describe('Validators', () => {
42384238
'+60195830837',
42394239
'+6019-5830837',
42404240
'+6019-5830837',
4241+
'+6010-4357675',
4242+
'+60172012370',
42414243
'0128737867',
4244+
'0172012370',
42424245
'01468987837',
4246+
'01112347345',
42434247
'016-2838768',
42444248
'016 2838768',
42454249
],

‎validator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ var phones = {
14131413
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
14141414
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
14151415
'lt-LT': /^(\+370|8)\d{8}$/,
1416-
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
1416+
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
14171417
'nb-NO': /^(\+?47)?[49]\d{7}$/,
14181418
'nl-BE': /^(\+?32|0)4?\d{8}$/,
14191419
'nn-NO': /^(\+?47)?[49]\d{7}$/,

‎validator.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.