diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-06-11 11:26:33 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-06-11 11:26:33 -0300 |
commit | 61d41ae57ec745b75ff9bc0568a2c6b9873acb89 (patch) | |
tree | 49fa4dfe617a5b1f48f40b59e2e1373340087edb | |
parent | 0a3b163772ab56ec0c0e775deec0ec3bed2b2825 (diff) |
infra: move fulfilled clause to end of if-else/if-else chain
-rw-r--r-- | src/content-function.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/content-function.js b/src/content-function.js index 2eb12f0e..c86d55a8 100644 --- a/src/content-function.js +++ b/src/content-function.js @@ -74,7 +74,14 @@ export function expectDependencies({ annotateFunction(wrappedGenerate, {name: generate, trait: 'invalidated'}); wrappedGenerate.fulfilled = false; - } else if (empty(missingContentDependencyKeys) && empty(missingExtraDependencyKeys)) { + } else if (!empty(missingContentDependencyKeys) || !empty(missingExtraDependencyKeys)) { + wrappedGenerate = function() { + throw new Error(`Dependencies still needed: ${missingContentDependencyKeys.concat(missingExtraDependencyKeys).join(', ')}`); + }; + + annotateFunction(wrappedGenerate, {name: generate, trait: 'unfulfilled'}); + wrappedGenerate.fulfilled = false; + } else { wrappedGenerate = function(arg1, arg2) { if (hasDataFunction && !arg1) { throw new Error(`Expected data`); @@ -103,13 +110,6 @@ export function expectDependencies({ wrappedGenerate.fulfill = function() { throw new Error(`All dependencies already fulfilled`); }; - } else { - wrappedGenerate = function() { - throw new Error(`Dependencies still needed: ${missingContentDependencyKeys.concat(missingExtraDependencyKeys).join(', ')}`); - }; - - annotateFunction(wrappedGenerate, {name: generate, trait: 'unfulfilled'}); - wrappedGenerate.fulfilled = false; } wrappedGenerate[contentFunction.identifyingSymbol] = true; |