mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
refactor: use const instead of func
This commit is contained in:
parent
04ccde246e
commit
4b498fa022
@ -72,10 +72,10 @@ export const useConnections = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function restructRawMsgToConnection(
|
export const restructRawMsgToConnection = (
|
||||||
connections: ConnectionRawMessage[],
|
connections: ConnectionRawMessage[],
|
||||||
prevActiveConnections: Connection[],
|
prevActiveConnections: Connection[],
|
||||||
): Connection[] {
|
): Connection[] => {
|
||||||
const prevMap = new Map<string, Connection>()
|
const prevMap = new Map<string, Connection>()
|
||||||
prevActiveConnections.forEach((prev) => prevMap.set(prev.id, prev))
|
prevActiveConnections.forEach((prev) => prevMap.set(prev.id, prev))
|
||||||
|
|
||||||
@ -98,13 +98,13 @@ export function restructRawMsgToConnection(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mergeAllConnections(activeConns: Connection[]) {
|
export const mergeAllConnections = (activeConns: Connection[]) => {
|
||||||
return unionWith(allConnections, activeConns, (a, b) => a.id === b.id)
|
return unionWith(allConnections, activeConns, (a, b) => a.id === b.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function diffClosedConnections(
|
const diffClosedConnections = (
|
||||||
activeConns: Connection[],
|
activeConns: Connection[],
|
||||||
allConns: Connection[],
|
allConns: Connection[],
|
||||||
) {
|
) => {
|
||||||
return differenceWith(allConns, activeConns, (a, b) => a.id === b.id)
|
return differenceWith(allConns, activeConns, (a, b) => a.id === b.id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user