diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-09-08 11:29:53 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-09-08 11:29:53 -0300 |
commit | 3ebe98d51d94a3e5277d65b2a4d2b5b433449214 (patch) | |
tree | 451c57ca48f321b740100433dea6702971f1ee60 | |
parent | ee46a4f78f1bfc8348834fbd3349849148f178a8 (diff) |
data: withResolvedReferenceList: handle undefined matches
-rw-r--r-- | src/data/things/thing.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js index 91ad96af..79d8ae0e 100644 --- a/src/data/things/thing.js +++ b/src/data/things/thing.js @@ -491,19 +491,20 @@ export function withResolvedReferenceList({ let matches = list.map(ref => findFunction(ref, data, {mode: 'quiet'})); - if (!matches.includes(null)) { + if (matches.every(match => match)) { return continuation.raise({matches}); } switch (notFoundMode) { case 'filter': - matches = matches.filter(value => value !== null); + matches = matches.filter(match => match); return continuation.raise({matches}); case 'exit': return continuation.exit([]); case 'null': + matches = matches.map(match => match ?? null); return continuation.raise({matches}); } }, |