From f6e268b3e09ea3e8a27960bbf99b63e97d6c31ba Mon Sep 17 00:00:00 2001 From: webdev03 <75148774+webdev03@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:38:27 +1300 Subject: [PATCH] Formatting --- src/classes/Studio.ts | 8 +++++--- src/classes/cloud/PacketCloud.ts | 2 +- src/classes/cloud/utils.ts | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/classes/Studio.ts b/src/classes/Studio.ts index 920d6ad..a25f872 100644 --- a/src/classes/Studio.ts +++ b/src/classes/Studio.ts @@ -233,9 +233,11 @@ class Studio { } } ); - if(!req.ok) { - throw Error(`Could not join studio -- did you get an invite? ${req.statusText}`); - }; + if (!req.ok) { + throw Error( + `Could not join studio -- did you get an invite? ${req.statusText}` + ); + } } /** diff --git a/src/classes/cloud/PacketCloud.ts b/src/classes/cloud/PacketCloud.ts index df2a7d8..7c9c0f4 100644 --- a/src/classes/cloud/PacketCloud.ts +++ b/src/classes/cloud/PacketCloud.ts @@ -13,7 +13,7 @@ class PacketCloud extends events.EventEmitter { const decoder = decode(data.value); const name = decoder.next().value; const value = decoder.next().value; - if(!name || !value) return; + if (!name || !value) return; this.emit(this.onRequest, name, value); this.emit(name, value); } diff --git a/src/classes/cloud/utils.ts b/src/classes/cloud/utils.ts index 5bef507..ba99b6c 100644 --- a/src/classes/cloud/utils.ts +++ b/src/classes/cloud/utils.ts @@ -1,16 +1,19 @@ -export const CHARSET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~1234567890! @#$%^&*()_-.\";:'?><,/".split(""); +export const CHARSET = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~1234567890! @#$%^&*()_-.\";:'?><,/".split( + "" + ); export function encode(string: string) { let result = ""; - for(let i = 0; i < string.length; i++) { - result += CHARSET.findIndex(x => x === string[i]) + 10; - }; + for (let i = 0; i < string.length; i++) { + result += CHARSET.findIndex((x) => x === string[i]) + 10; + } return result + "00"; -}; +} export function* decode(string: string) { let value = ""; - for(let i = 1; i < string.length; i += 2) { - const idx = Number(string[i-1] + string[i]) - 10; - if(idx < 0) { + for (let i = 1; i < string.length; i += 2) { + const idx = Number(string[i - 1] + string[i]) - 10; + if (idx < 0) { yield value; value = ""; } else value += CHARSET[idx];