From 95c298002f3bbe4f01bf9ee245e3b827da598cbd Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 6 Jan 2021 17:17:34 -0700 Subject: [PATCH] Implement a toJSON function. --- server/src/objects/Deck.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/src/objects/Deck.ts b/server/src/objects/Deck.ts index 1d04a7b..78ae90c 100644 --- a/server/src/objects/Deck.ts +++ b/server/src/objects/Deck.ts @@ -56,4 +56,16 @@ export class Deck { this._unknown = this._unknown.filter(x => x != card); this._discard.push(card); }; + + + public toJSON(): datastoreDeck { + /** + * Converts this Deck into a JSON-compatible object + */ + return { + deck: this._deck, + unknown: this._unknown, + discard: this._discard, + }; + }; }; \ No newline at end of file