server for my chess game
Diffstat (limited to 'src/utils.js')
| -rw-r--r-- | src/utils.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..200df5d --- /dev/null +++ b/src/utils.js @@ -0,0 +1,13 @@ +export function str_obj(obj) { + return JSON.stringify(obj, null, 0); +} + +export function flip_int(int) { + return int === 0 ? 1 : 0; +} + +export function send_group_packet(data, header, clients) { + clients.forEach((client) => { + if (client) client.send_packet(data, header); + }); +} |