if (taskFunctions == null) {
throw new Error('taskFunctions parameter is mandatory')
}
- if (
- typeof taskFunctions !== 'function' &&
- typeof taskFunctions !== 'object'
- ) {
- throw new TypeError(
- 'taskFunctions parameter is not a function or an object'
- )
- }
this.taskFunctions = new Map<string, WorkerFunction<Data, Response>>()
if (typeof taskFunctions === 'function') {
this.taskFunctions.set(DEFAULT_FUNCTION_NAME, taskFunctions.bind(this))
throw new Error('taskFunctions parameter object is empty')
}
} else {
- throw new TypeError('taskFunctions parameter is not an object literal')
+ throw new TypeError(
+ 'taskFunctions parameter is not a function or a plain object'
+ )
}
}