Create method to convert Game objects to JSON
This commit is contained in:
parent
c2e28ce14b
commit
cb492fd275
1 changed files with 7 additions and 0 deletions
|
|
@ -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`)
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue