File

src/app/providers/pipes/mask.pipe.ts

Metadata

Name mask

Methods

transform
transform(value: string)
Parameters :
Name Type Optional
value string No
Returns : string
import { Pipe, PipeTransform } from '@angular/core';

const MASKLENGTH = 5;
@Pipe({
  name: 'mask'
})
export class MaskPipe implements PipeTransform {
  transform(value: string): string {
    const length = MASKLENGTH ? MASKLENGTH : 5; // note defaults to 5 if MAXLENGTH is 0
    return value ? `*${value.substr(-length)}` : '';
  }
}

result-matching ""

    No results matching ""