-import { checkValidWorkerChoiceStrategy } from '../pools/utils.js'
+import {
+ checkValidPriority,
+ checkValidWorkerChoiceStrategy,
+} from '../pools/utils.js'
import { isPlainObject } from '../utils.js'
import type { TaskFunctionObject } from './task-functions.js'
import { KillBehaviors, type WorkerOptions } from './worker-options.js'
}
}
-export const checkValidTaskFunctionEntry = <Data = unknown, Response = unknown>(
- name: string,
- fnObj: TaskFunctionObject<Data, Response>
-): void => {
+export const checkValidTaskFunctionObjectEntry = <
+ Data = unknown,
+ Response = unknown
+>(
+ name: string,
+ fnObj: TaskFunctionObject<Data, Response>
+ ): void => {
if (typeof name !== 'string') {
throw new TypeError('A taskFunctions parameter object key is not a string')
}
`taskFunction object 'taskFunction' property '${fnObj.taskFunction}' is not a function`
)
}
- if (fnObj.priority != null && !Number.isSafeInteger(fnObj.priority)) {
- throw new TypeError(
- `taskFunction object 'priority' property '${fnObj.priority}' is not an integer`
- )
- }
+ checkValidPriority(fnObj.priority)
checkValidWorkerChoiceStrategy(fnObj.strategy)
}