Implement fromJSON method
This commit is contained in:
parent
ce252d471a
commit
b155791f26
1 changed files with 10 additions and 0 deletions
|
|
@ -68,4 +68,14 @@ export class Deck<T> {
|
|||
discard: this._discard,
|
||||
};
|
||||
};
|
||||
|
||||
public static fromJSON<A>(data: datastoreDeck<A>): Deck<A> {
|
||||
/**
|
||||
* Converts the JSON representation of a deck into a Deck
|
||||
*/
|
||||
let d = new Deck(data.deck);
|
||||
d._discard = data.discard;
|
||||
d._unknown = data.unknown;
|
||||
return d;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue