Skip to content

Commit e1345a2

Browse files
author
Your Name
committed
au-mask
1 parent 54e3976 commit e1345a2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

au-mask/src/app/au-mask/au-mask.directive.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import {Directive, ElementRef, Input, OnInit} from '@angular/core';
22

3+
import * as includes from 'lodash.includes';
4+
import {SPECIAL_CHARACTERS} from "./mask.utils";
5+
36
@Directive({
47
selector: '[au-mask]'
58
})
@@ -24,10 +27,24 @@ export class AuMaskDirective implements OnInit {
2427

2528
buildPlaceHolder(): string {
2629

27-
const value = '';
30+
const chars = this.mask.split('');
31+
32+
return chars.reduce((result, char) => {
33+
34+
return result +=
35+
includes(SPECIAL_CHARACTERS, char) ? char : '_'
36+
37+
} , '' );
2838

29-
return value;
3039

3140
}
3241

3342
}
43+
44+
45+
46+
47+
48+
49+
50+

0 commit comments

Comments
 (0)