From 998cc860302e3fb1e7a40c055e8ac66f195b1366 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 21 Sep 2023 15:54:34 -0300 Subject: data: withResultOfAvailabilityCheck: handle undefined in 'empty' --- src/data/things/composite.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/things/composite.js b/src/data/things/composite.js index 4074aef..700cc92 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': -- cgit 1.3.0-6-gf8a5