repositories
/
poolifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3557031
)
refactor: improve task functions type checking
author
Jérôme Benoit
<jerome.benoit@sap.com>
Sun, 9 Jul 2023 21:29:41 +0000
(23:29 +0200)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Sun, 9 Jul 2023 21:29:41 +0000
(23:29 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/abstract-worker.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/worker/abstract-worker.ts
b/src/worker/abstract-worker.ts
index 7aa626f1610a3cd4f4e30ca23232b640a1eca410..1c1ff3d7700d72e11ad02d48b4e283282241833a 100644
(file)
--- a/
src/worker/abstract-worker.ts
+++ b/
src/worker/abstract-worker.ts
@@
-123,6
+123,11
@@
export abstract class AbstractWorker<
} else if (isPlainObject(taskFunctions)) {
let firstEntry = true
for (const [name, fn] of Object.entries(taskFunctions)) {
+ if (typeof name !== 'string') {
+ throw new TypeError(
+ 'A taskFunctions parameter object key is not a string'
+ )
+ }
if (typeof fn !== 'function') {
throw new TypeError(
'A taskFunctions parameter object value is not a function'