From: Jérôme Benoit Date: Tue, 19 Mar 2024 17:58:30 +0000 (+0100) Subject: fix: fix worker set elementsPerWorker sanity check X-Git-Tag: v1.3.1~30 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=195c627f62717d86ebc1c3dfd4a69f25277ceb70;p=e-mobility-charging-stations-simulator.git fix: fix worker set elementsPerWorker sanity check Signed-off-by: Jérôme Benoit --- diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index d0f80b6e..10606d2e 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -36,7 +36,10 @@ export class WorkerSet extends WorkerAbstract { if (!Number.isSafeInteger(this.workerOptions.elementsPerWorker)) { throw new TypeError('Elements per worker must be an integer') } - if (this.workerOptions.elementsPerWorker <= 0) { + if ( + typeof this.workerOptions.elementsPerWorker === 'number' && + this.workerOptions.elementsPerWorker <= 0 + ) { throw new RangeError('Elements per worker must be greater than zero') } this.workerSet = new Set()