Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
mask field
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Mar 6, 2018
1 parent 145188c commit a3beb04
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/models/view/fieldView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ import { Field } from '../domain/field';

export class FieldView implements View {
name: string;
value: string;
type: FieldType;

// tslint:disable
private _value: string;
private _maskedValue: string;
// tslint:enable

constructor(f?: Field) {
if (!f) {
return;
Expand All @@ -21,22 +17,7 @@ export class FieldView implements View {
this.type = f.type;
}

get value(): string {
return this._value;
}
set value(value: string) {
this._value = value;
this._maskedValue = null;
}

get maskedValue(): string {
if (this._maskedValue == null && this.value != null) {
this._maskedValue = '';
for (let i = 0; i < this.value.length; i++) {
this._maskedValue += '•';
}
}

return this._maskedValue;
return this.value != null ? '••••••••' : null;
}
}

0 comments on commit a3beb04

Please sign in to comment.