diff --git a/src/gateway/util/Send.ts b/src/gateway/util/Send.ts
index 57f87d8b..86f75a9a 100644
--- a/src/gateway/util/Send.ts
+++ b/src/gateway/util/Send.ts
@@ -37,15 +37,13 @@ const recurseJsonReplace = (json: any) => {
json[key] = JSONReplacer.call(json, key, json[key]);
- if (typeof json[key] == "object" && json[key] !== null)
- json[key] = recurseJsonReplace(json[key]);
+ if (typeof json[key] == "object" && json[key] !== null) json[key] = recurseJsonReplace(json[key]);
}
return json;
};
export function Send(socket: WebSocket, data: Payload) {
- if (process.env.WS_VERBOSE)
- console.log(`[Websocket] Outgoing message: ${JSON.stringify(data)}`);
+ if (process.env.WS_VERBOSE) console.log(`[Websocket] Outgoing message: ${JSON.stringify(data)}`);
if (process.env.WS_DUMP) {
const id = socket.session_id || "unknown";
@@ -54,10 +52,7 @@ export function Send(socket: WebSocket, data: Payload) {
await fs.mkdir(path.join("dump", id), {
recursive: true,
});
- await fs.writeFile(
- path.join("dump", id, `${Date.now()}.out.json`),
- JSON.stringify(data, null, 2),
- );
+ await fs.writeFile(path.join("dump", id, `${Date.now()}.out.json`), JSON.stringify(data, null, 2));
})();
}
@@ -68,8 +63,7 @@ export function Send(socket: WebSocket, data: Payload) {
buffer = erlpack.pack(data);
}
// TODO: encode circular object
- else if (socket.encoding === "json")
- buffer = JSON.stringify(data, JSONReplacer);
+ else if (socket.encoding === "json") buffer = JSON.stringify(data, JSONReplacer);
else return;
// TODO: compression
if (socket.deflate) {
diff --git a/src/gateway/util/SessionUtils.ts b/src/gateway/util/SessionUtils.ts
index 9238db72..26e7bdd6 100644
--- a/src/gateway/util/SessionUtils.ts
+++ b/src/gateway/util/SessionUtils.ts
@@ -25,7 +25,5 @@ export function genVoiceToken() {
}
function genRanHex(size: number) {
- return [...Array(size)]
- .map(() => Math.floor(Math.random() * 16).toString(16))
- .join("");
+ return [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join("");
}
|