Skip to content

Commit

Permalink
feat(isMobilePhone): update de-CH, add fr-CH, it-CH locales (#1554)
Browse files Browse the repository at this point in the history
* fix(isMobilePhone): update de-CH locale (#1549)
feat(isMobilePhone): add fr-CH locale (#1549)
feat(isMobilePhone): add it-CH locale (#1549)

* fix(isMobilePhone): update de-CH, fr-CH and it-CH locale in validator.min.js(#1549)

* fix(isMobilePhone): update fr-CH and it-CH locale aliases (#1549)

Co-authored-by: Ashutosh Kumar <kumar.ashutosh@siemens.com>
  • Loading branch information
Ashutosh Kumar and Ashutosh Kumar authored Dec 17, 2020
1 parent 787df19 commit 738cf60
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const phones = {
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
Expand Down Expand Up @@ -123,6 +123,8 @@ phones['fr-BE'] = phones['nl-BE'];
phones['zh-HK'] = phones['en-HK'];
phones['zh-MO'] = phones['en-MO'];
phones['ga-IE'] = phones['en-IE'];
phones['fr-CH'] = phones['de-CH'];
phones['it-CH'] = phones['fr-CH'];

export default function isMobilePhone(str, locale, options) {
assertString(str);
Expand Down
5 changes: 3 additions & 2 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -7487,7 +7487,7 @@ describe('Validators', () => {
});
});

// de-CH
// de-CH, fr-CH, it-CH
test({
validator: 'isMobilePhone',
valid: [
Expand All @@ -7496,9 +7496,10 @@ describe('Validators', () => {
'+41771112233',
'+41781112233',
'+41791112233',
'+411122112211',
],
invalid: [
'+41441112233',
'+41041112233',
],
args: [],
});
Expand Down
4 changes: 3 additions & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3782,7 +3782,7 @@ var phones = {
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
Expand Down Expand Up @@ -3877,6 +3877,8 @@ phones['fr-BE'] = phones['nl-BE'];
phones['zh-HK'] = phones['en-HK'];
phones['zh-MO'] = phones['en-MO'];
phones['ga-IE'] = phones['en-IE'];
phones['fr-CH'] = phones['de-CH'];
phones['it-CH'] = phones['fr-CH'];
function isMobilePhone(str, locale, options) {
assertString(str);

Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit 738cf60

Please sign in to comment.