frontello-datas-format
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -20,14 +20,23 @@ "use strict"; | ||
if (this.phone.length > 2) { | ||
phone = this.phone.substring(0, 2) + ' ' + this.phone.substring(2, 4); | ||
switch (this.phone.length) { | ||
case 10: | ||
phone = phone.replace('/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/', '$1 $2 $3 $4 $5', phone); | ||
break; | ||
case 11: | ||
phone = phone.replace('/^(\d{3})(\d{2})(\d{2})(\d{2})(\d{2})$/', '$1 $2 $3 $4 $5', phone); | ||
break; | ||
case 12: | ||
phone = phone.replace('/^(\d{2})(\d{3})(\d{3})(\d{3})$/', '$1 $2 $3 $4', phone); | ||
break; | ||
case 13: | ||
phone = phone.replace('/^(\+\d{2})(\d{3})(\d{3})(\d{3})$/', '$1 $2 $3 $4', phone); | ||
break; | ||
} | ||
if (this.phone.length > 4) { | ||
phone = phone + ' ' + this.phone.substring(4, 6); | ||
} | ||
if (this.phone.length > 6) { | ||
phone = phone + ' ' + this.phone.substring(6, 8); | ||
} | ||
if (this.phone.length > 8) { | ||
phone = phone + ' ' + this.phone.substring(8, 10); | ||
} | ||
@@ -39,3 +48,3 @@ return phone; | ||
{ | ||
if (!/^(0)([0-9]{9})$/.test(this.phone)) { | ||
if (!/^(33|0)([0-9]{9})$/.test(this.phone)) { | ||
return false; | ||
@@ -45,3 +54,3 @@ } | ||
if (mobile) { | ||
if (!/^(0)([6|7])([0-9]{8})$/.test(this.phone)) { | ||
if (!/^(33|0)([6|7])([0-9]{8})$/.test(this.phone)) { | ||
return false; | ||
@@ -48,0 +57,0 @@ } |
{ | ||
"name": "frontello-datas-format", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "UI format", | ||
@@ -5,0 +5,0 @@ "main": "format.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12105
506