« get me outta code hell

data: withResultOfAvailabilityCheck: handle undefined in 'empty' - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-21 15:54:34 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-21 15:54:41 -0300
commit998cc860302e3fb1e7a40c055e8ac66f195b1366 (patch)
tree68aeb705037e229b64ebea0d85c31ca41762ec1d /src/data/things
parent8e3e15be98d43c1aa8a4f13709106f6848a0a9e4 (diff)
data: withResultOfAvailabilityCheck: handle undefined in 'empty'
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/composite.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/data/things/composite.js b/src/data/things/composite.js
index 4074aef7..700cc922 100644
--- a/src/data/things/composite.js
+++ b/src/data/things/composite.js
@@ -1512,8 +1512,8 @@ export const exposeConstant = templateCompositeFrom({
 // Customize {mode} to select one of these modes, or default to 'null':
 //
 // * 'null':  Check that the value isn't null (and not undefined either).
-// * 'empty': Check that the value is neither null nor an empty array.
-//            This will outright error for undefined.
+// * 'empty': Check that the value is neither null, undefined, nor an empty
+//            array.
 // * 'falsy': Check that the value isn't false when treated as a boolean
 //            (nor an empty array). Keep in mind this will also be false
 //            for values like zero and the empty string!
@@ -1546,11 +1546,11 @@ export const withResultOfAvailabilityCheck = templateCompositeFrom({
 
         switch (mode) {
           case 'null':
-            availability = value !== null && value !== undefined;
+            availability = value !== undefined && value !== null;
             break;
 
           case 'empty':
-            availability = !empty(value);
+            availability = value !== undefined && !empty(value);
             break;
 
           case 'falsy':