diff --git a/src/cluster.ts b/src/cluster.ts index d7224f6f..ce19ea26 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -124,12 +124,12 @@ export class Cluster { } close() { - this.#connections.forEach((connection) => { + for (const conn of this.#connections) { try { - Deno.close(connection.rid); + Deno.close(conn.rid); } catch (error) { console.error(`Error closing connection: ${error}`); } - }); + } } } diff --git a/src/protocol/message.ts b/src/protocol/message.ts index 9ff18dd9..cfd427eb 100644 --- a/src/protocol/message.ts +++ b/src/protocol/message.ts @@ -76,10 +76,10 @@ export function serializeMessage(message: Message): Uint8Array[] { view.setInt32(0, message.flags ?? 0, true); let pos = 4; - sections.forEach((section) => { + for (const section of sections) { buffer.set(section, pos); pos += section.byteLength; - }); + } const header = serializeHeader({ messageLength: 16 + buffer.byteLength, diff --git a/src/protocol/protocol.ts b/src/protocol/protocol.ts index c54e496f..21bcfd82 100644 --- a/src/protocol/protocol.ts +++ b/src/protocol/protocol.ts @@ -57,13 +57,13 @@ export class WireProtocol { let documents: T[] = []; - message?.sections.forEach((section) => { + for (const section of message?.sections!) { if ("document" in section) { documents.push(section.document as T); } else { documents = documents.concat(section.documents as T[]); } - }); + } return documents; } diff --git a/src/utils/srv.ts b/src/utils/srv.ts index aab28007..478f1865 100644 --- a/src/utils/srv.ts +++ b/src/utils/srv.ts @@ -95,11 +95,11 @@ export class Srv { valid: {}, illegal: [], }; - optionsUri.split("&").forEach((option: string) => { + for (const option of optionsUri.split("&")) { const [key, value] = option.split("="); if (isAllowedOption(key) && !!value) options.valid[key] = value; else options.illegal.push(option); - }); + } if (options.illegal.length !== 0) { throw new SRVError( diff --git a/tests/cases/01_auth.ts b/tests/cases/01_auth.ts index 327e8256..1b4cb4a2 100644 --- a/tests/cases/01_auth.ts +++ b/tests/cases/01_auth.ts @@ -16,7 +16,7 @@ interface PasswordValid { digest: string; } -const passwordValdis: PasswordValid[] = [ +const passwordValids: PasswordValid[] = [ { username: "user", password: "pencil", @@ -30,7 +30,7 @@ const passwordValdis: PasswordValid[] = [ ]; export default function authTests() { - passwordValdis.forEach(({ username, password, digest }) => { + for (const { username, password, digest } of passwordValids) { Deno.test({ name: `passwordDigest:${username}:${password}`, fn() { @@ -38,7 +38,7 @@ export default function authTests() { assertEquals(digestRes, digest); }, }); - }); + } Deno.test({ name: "clientFirstMessageBare",