Skip to content

Commit

Permalink
refactor: handle loaded module
Browse files Browse the repository at this point in the history
  • Loading branch information
sculpt0r committed Mar 27, 2023
1 parent 7fe1622 commit 7223a74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/worker/base.js
Expand Up @@ -184,9 +184,10 @@ const run = async options => {
const loadedModule = await load(path);

if (typeof loadedModule === 'function') {
await loadedModule.apply(...options);
await loadedModule(...options);
} else if (typeof loadedModule.default === 'function') {
await loadedModule.default.apply(...options);
const { default: fn } = loadedModule;

Check failure on line 189 in lib/worker/base.js

View workflow job for this annotation

GitHub Actions / Lint source files

There should be no space after '{'.

Check failure on line 189 in lib/worker/base.js

View workflow job for this annotation

GitHub Actions / Lint source files

There should be no space before '}'.
await fn(...options);
} else {
channel.send({type: 'non-invokable-require-option'});
}
Expand Down

0 comments on commit 7223a74

Please sign in to comment.