Repository: validatorjs/validator.js
Pull request #1575 (2021-01-07 07:18:46)

isMobileNumber(phone,"vi-VN"): support new telco numbers 087
We have new telco (https://didong.itelecom.vn/) with number 087***
Update library to support this number as valid VN phone number.

## Checklist

- [x] PR contains only changes related; no stray files, etc.
- [x] README updated (where applicable)
- [x] Tests written (where applicable)


codecov[bot]: # [Codecov](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=h1) Report
> Merging [#1575](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=desc) (c2926ca) into [master](https://codecov.io/gh/validatorjs/validator.js/commit/8831db31e7d5de03cb9744f811ffd256494f97f6?el=desc) (8831db3) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/validatorjs/validator.js/pull/1575/graphs/tree.svg?width=650&height=150&src=pr&token=YzR3kbN1m2)](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master     #1575   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          100       100           
  Lines         1796      1796           
=========================================
  Hits          1796      1796           
```


| [Impacted Files](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/lib/isMobilePhone.js](https://codecov.io/gh/validatorjs/validator.js/pull/1575/diff?src=pr&el=tree#diff-c3JjL2xpYi9pc01vYmlsZVBob25lLmpz) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=footer). Last update [8831db3...0519f9e](https://codecov.io/gh/validatorjs/validator.js/pull/1575?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

kyled7: > Could you add the tests too for completeness? After that, we should be good to go.

Thanks, I added tests for the change.

Patch:
diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js
index c34d45d..68a1992 100644
--- a/src/lib/isMobilePhone.js
+++ b/src/lib/isMobilePhone.js
@@ -110,7 +110,7 @@ const phones = {
   'tr-TR': /^(\+?90|0)?5\d{9}$/,
   'uk-UA': /^(\+?38|8)?0\d{9}$/,
   'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
-  'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/,
+  'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
   'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/,
   'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
 };


Test patch:
diff --git a/test/validators.js b/test/validators.js
index baeca63..b9899b6 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -6391,6 +6391,7 @@ describe('Validators', () => {
           '0883805866',
           '0892405867',
           '+84888696413',
+          '0878123456',
         ],
         invalid: [
           '12345',