1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-23 11:43:51 +00:00

move export models to jslib

This commit is contained in:
Kyle Spearrin
2018-12-17 10:29:37 -05:00
parent 27566c3fd5
commit 94f103c474
12 changed files with 458 additions and 0 deletions

44
src/models/export/card.ts Normal file
View File

@@ -0,0 +1,44 @@
import { CardView } from '../view/cardView';
export class Card {
static template(): Card {
const req = new Card();
req.cardholderName = 'John Doe';
req.brand = 'visa';
req.number = '4242424242424242';
req.expMonth = '04';
req.expYear = '2023';
req.code = '123';
return req;
}
static toView(req: Card, view = new CardView()) {
view.cardholderName = req.cardholderName;
view.brand = req.brand;
view.number = req.number;
view.expMonth = req.expMonth;
view.expYear = req.expYear;
view.code = req.code;
return view;
}
cardholderName: string;
brand: string;
number: string;
expMonth: string;
expYear: string;
code: string;
constructor(o?: CardView) {
if (o == null) {
return;
}
this.cardholderName = o.cardholderName;
this.brand = o.brand;
this.number = o.number;
this.expMonth = o.expMonth;
this.expYear = o.expYear;
this.code = o.code;
}
}