From ee79e8e50d9e6187366b8daf419cf095e16cc34d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 21 Dec 2023 00:04:01 +0100 Subject: [PATCH] refactor: cleanup default arguments handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.34.1