import { Pipe , PipeTransform } from '@angular/core' ; import { MaskApplierService } from './mask-applier.service' ; import { IConfig } from './config' ; @ Pipe ( { name : 'mask' , pure : true , } ) export class MaskPipe implements PipeTransform { public constructor ( private _maskService ) { } public transform ( value , mask , thousandSeparator = null ) { if ( ! value && typeof value !== 'number' ) { return '' ; } if ( thousandSeparator ) { this . _maskService . thousandSeparator = thousandSeparator ; } if ( typeof mask === 'string' ) { return this . _maskService . applyMask ( `${ value }` , mask ) ; } return this . _maskService . applyMaskWithPattern ( `${ value }` , mask ) ; } }