« get me outta code hell

infra: move fulfilled clause to end of if-else/if-else chain - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content-function.js
diff options
context:
space:
mode:
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
commit61d41ae57ec745b75ff9bc0568a2c6b9873acb89 (patch)
tree49fa4dfe617a5b1f48f40b59e2e1373340087edb /src/content-function.js
parent0a3b163772ab56ec0c0e775deec0ec3bed2b2825 (diff)
infra: move fulfilled clause to end of if-else/if-else chain
Diffstat (limited to 'src/content-function.js')
-rw-r--r--src/content-function.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/content-function.js b/src/content-function.js
index 2eb12f0..c86d55a 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;