Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledzz committed Nov 11, 2018
1 parent 6924a0c commit 081b1b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion projects/ngx-phone-mask/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-phone-mask",
"version": "3.2.1",
"version": "3.2.2",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0",
Expand Down
4 changes: 4 additions & 0 deletions projects/ngx-phone-mask/src/lib/ngx-phone-mask.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { mask } from './utils';

export class NgxPhoneMaskPipe implements PipeTransform {
transform(value: string): string {
if (!value) {
return '';
}

return conformToMask(
value,
mask(),
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-phone-mask/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const clean = (number) => {
};

export const mask = () => (rawValue) => {
if (!rawValue || clean(rawValue).length <= 12) {
if (clean(rawValue).length <= 12) {
return ['+', /[1-9]/, ' ', '(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, '-', /\d/, /\d/];
}

Expand Down

0 comments on commit 081b1b1

Please sign in to comment.