mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
move export models to jslib
This commit is contained in:
34
src/models/export/field.ts
Normal file
34
src/models/export/field.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { FieldType } from '../../enums/fieldType';
|
||||
|
||||
import { FieldView } from '../view/fieldView';
|
||||
|
||||
export class Field {
|
||||
static template(): Field {
|
||||
const req = new Field();
|
||||
req.name = 'Field name';
|
||||
req.value = 'Some value';
|
||||
req.type = FieldType.Text;
|
||||
return req;
|
||||
}
|
||||
|
||||
static toView(req: Field, view = new FieldView()) {
|
||||
view.type = req.type;
|
||||
view.value = req.value;
|
||||
view.name = req.name;
|
||||
return view;
|
||||
}
|
||||
|
||||
name: string;
|
||||
value: string;
|
||||
type: FieldType;
|
||||
|
||||
constructor(o?: FieldView) {
|
||||
if (o == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.name = o.name;
|
||||
this.value = o.value;
|
||||
this.type = o.type;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user