fix: fix worker set elementsPerWorker sanity check
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 19 Mar 2024 17:58:30 +0000 (18:58 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 19 Mar 2024 17:58:30 +0000 (18:58 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/WorkerSet.ts

index d0f80b6ed59a54342430991ff4d318d86e0a5402..10606d2e498639bb6d0097f2d6c3740465746113 100644 (file)
@@ -36,7 +36,10 @@ export class WorkerSet extends WorkerAbstract<WorkerData> {
     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<WorkerSetElement>()