From 2a5510c56ed655a0ae213bb7353a7d0ebcb3c4da Mon Sep 17 00:00:00 2001 From: benStre Date: Sat, 10 Feb 2024 23:05:41 +0100 Subject: [PATCH] minor refactoring --- network/communication-hub.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/network/communication-hub.ts b/network/communication-hub.ts index bd3d3e78..2f130fa2 100644 --- a/network/communication-hub.ts +++ b/network/communication-hub.ts @@ -545,21 +545,21 @@ export class CommunicationHubHandler { const receivers = data.receivers instanceof Endpoint ? [data.receivers] : [...data.receivers]; const outGroups = receivers.length == 1 ? - // single endpoint shortcut - new Map([[this.getPreferredSocketForEndpoint(receivers[0], data.socket), new Disjunction(...receivers)]]) : - - // group for multiple endpoints - new Map( - // group receivers by socket - [...Map.groupBy( - // map receivers to sockets - receivers.map(r => ({endpoint: r, socket: this.getPreferredSocketForEndpoint(r, data.socket)}), - ), ({socket}) => socket - ).entries() - ] - // map endpoint object arrays to Set - .map(([k, v]) => [k, new Disjunction(...v.map(({endpoint}) => endpoint))] as const) - ); + // single endpoint shortcut + new Map([[this.getPreferredSocketForEndpoint(receivers[0], data.socket), new Disjunction(receivers[0])]]) : + + // group for multiple endpoints + new Map( + // group receivers by socket + [...Map.groupBy( + // map receivers to sockets + receivers.map(r => ({endpoint: r, socket: this.getPreferredSocketForEndpoint(r, data.socket)}), + ), ({socket}) => socket + ).entries() + ] + // map endpoint object arrays to Set + .map(([k, v]) => [k, new Disjunction(...v.map(({endpoint}) => endpoint))] as const) + ); const promises = []