From 61d41ae57ec745b75ff9bc0568a2c6b9873acb89 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 11 Jun 2023 11:26:33 -0300 Subject: infra: move fulfilled clause to end of if-else/if-else chain --- src/content-function.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') 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; -- cgit 1.3.0-6-gf8a5