Skip to content

Commit

Permalink
fix(isMobilePhone): update ms-MY locale (#950)
Browse files Browse the repository at this point in the history
* Added a digit 0 for malaysian phone number prefix

* Added test for MY numbers, should be good now
  • Loading branch information
Idris Akmal Haslin authored and chriso committed Dec 23, 2018
1 parent 52f7673 commit 556f54f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var phones = {
'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}$/,
'lt-LT': /^(\+370|8)\d{8}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'nb-NO': /^(\+?47)?[49]\d{7}$/,
'nl-BE': /^(\+?32|0)4?\d{8}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const phones = {
'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}$/,
'lt-LT': /^(\+370|8)\d{8}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'nb-NO': /^(\+?47)?[49]\d{7}$/,
'nl-BE': /^(\+?32|0)4?\d{8}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
Expand Down
4 changes: 4 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4238,8 +4238,12 @@ describe('Validators', () => {
'+60195830837',
'+6019-5830837',
'+6019-5830837',
'+6010-4357675',
'+60172012370',
'0128737867',
'0172012370',
'01468987837',
'01112347345',
'016-2838768',
'016 2838768',
],
Expand Down
2 changes: 1 addition & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ var phones = {
'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}$/,
'lt-LT': /^(\+370|8)\d{8}$/,
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'nb-NO': /^(\+?47)?[49]\d{7}$/,
'nl-BE': /^(\+?32|0)4?\d{8}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit 556f54f

Please sign in to comment.