From: Jérôme Benoit Date: Wed, 20 Dec 2023 23:04:01 +0000 (+0100) Subject: refactor: cleanup default arguments handling X-Git-Tag: v3.1.8~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ee79e8e50d9e6187366b8daf419cf095e16cc34d;p=poolifier.git refactor: cleanup default arguments handling Signed-off-by: Jérôme Benoit --- diff --git a/src/utils.ts b/src/utils.ts index 8e84e947..3226e7eb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -304,8 +304,9 @@ export const buildInternalWorkerChoiceStrategyOptions = ( const getDefaultWeights = ( poolMaxSize: number, - defaultWorkerWeight: number = getDefaultWorkerWeight() + defaultWorkerWeight?: number ): Record => { + defaultWorkerWeight = defaultWorkerWeight ?? getDefaultWorkerWeight() const weights: Record = {} for (let workerNodeKey = 0; workerNodeKey < poolMaxSize; workerNodeKey++) { weights[workerNodeKey] = defaultWorkerWeight