import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'idNumber' })
export class IdNumberPipe implements PipeTransform {
      transform(value): string {
        if( value && (value.length == 18 || value.length == 15)) {
            //let idCard = value.replace(/(^\d{6}|\d{3})(\d{8})(\d{2})(\d{2}|X$)/, "$1**********$3$4");
            let idCard = value.replace(/(.{6}).*(.{4})/, "$1********$2");
            return idCard;
        } else {
            return value;
        }
      }
}
