From cb492fd2755d3856edef4d81fd095c165208c63e Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 29 Sep 2020 22:58:11 -0600 Subject: [PATCH] Create method to convert Game objects to JSON --- src/utils/Game.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/Game.ts b/src/utils/Game.ts index bea6c2c..0930fba 100644 --- a/src/utils/Game.ts +++ b/src/utils/Game.ts @@ -28,4 +28,11 @@ class Game { }; return `Game(code=${this.code},players=${players.join(',')})`; }; + + public toJSON(): string { + return JSON.stringify({ + code: this.code, + players: this.#_players, + }, undefined, `\t`) + }; }; \ No newline at end of file