Skip to content

Commit

Permalink
Create Display*inPlaceofaValue.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
roshanmehta01 authored Oct 2, 2020
1 parent 1396e36 commit cdfe385
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions UsefulCode/Display*inPlaceofaValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Angular Imports
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'password'
})
export class PasswordPipe implements PipeTransform {

transform(value: string, replaceChar?: string): any {
if (value === undefined) {
return value;
}
// Replace with the specified character
if (replaceChar) {
return replaceChar.repeat(value.length);
}
// Replace value with asterisks
return '*'.repeat(value.length);
}
}

0 comments on commit cdfe385

Please sign in to comment.