chore: generate documentation
[poolifier.git] / src / worker / abstract-worker.ts
index 7aa626f1610a3cd4f4e30ca23232b640a1eca410..5598378a241cb94f3901f35b4ad621d87a2599d2 100644 (file)
@@ -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'
@@ -375,7 +380,7 @@ export abstract class AbstractWorker<
   }
 
   /**
-   * Runs the given function synchronously.
+   * Runs the given task function synchronously.
    *
    * @param fn - Task function that will be executed.
    * @param task - Input data for the task function.
@@ -413,7 +418,7 @@ export abstract class AbstractWorker<
   }
 
   /**
-   * Runs the given function asynchronously.
+   * Runs the given task function asynchronously.
    *
    * @param fn - Task function that will be executed.
    * @param task - Input data for the task function.