1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +00:00

defining more abstractions

This commit is contained in:
Kyle Spearrin
2018-01-25 14:26:09 -05:00
parent e5c1adedff
commit 11755e409a
9 changed files with 111 additions and 45 deletions

View File

@@ -6,10 +6,33 @@ import { Field } from '../domain/field';
export class FieldView implements View {
name: string;
vault: string;
type: FieldType;
// tslint:disable
private _value: string;
private _maskedValue: string;
// tslint:enable
constructor(f: Field) {
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;
}
}