if (!isMainThread) { const { limit } = workerData; if (!Number.isInteger(limit) || limit < 2) { throw new RangeError('limit must be an integer of at least 2'); } parentPort.postMessage({ threadId, count: countPrimes(limit), }); }