From 5eac956b82276d6342b4bbe6b10fac7b3a783bc4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 6 Feb 2024 08:16:00 -0400 Subject: data: withResolvedReference: remove notFoundMode input --- .../composite/wiki-data/withResolvedReference.js | 32 ++++++---------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'src/data/composite/wiki-data') diff --git a/src/data/composite/wiki-data/withResolvedReference.js b/src/data/composite/wiki-data/withResolvedReference.js index 0fa5c554..ea71707e 100644 --- a/src/data/composite/wiki-data/withResolvedReference.js +++ b/src/data/composite/wiki-data/withResolvedReference.js @@ -1,12 +1,10 @@ // Resolves a reference by using the provided find function to match it // within the provided thingData dependency. This will early exit if the -// data dependency is null, or, if notFoundMode is set to 'exit', if the find -// function doesn't match anything for the reference. Otherwise, the data -// object is provided on the output dependency; or null, if the reference -// doesn't match anything or itself was null to begin with. +// data dependency is null. Otherwise, the data object is provided on the +// output dependency, or null, if the reference doesn't match anything or +// itself was null to begin with. import {input, templateCompositeFrom} from '#composite'; -import {is} from '#validators'; import { exitWithoutDependency, @@ -23,11 +21,6 @@ export default templateCompositeFrom({ data: inputWikiData({allowMixedTypes: false}), find: input({type: 'function'}), - - notFoundMode: input({ - validate: is('null', 'exit'), - defaultValue: 'null', - }), }, outputs: ['#resolvedReference'], @@ -49,25 +42,16 @@ export default templateCompositeFrom({ input('ref'), input('data'), input('find'), - input('notFoundMode'), ], - compute(continuation, { + compute: (continuation, { [input('ref')]: ref, [input('data')]: data, [input('find')]: findFunction, - [input('notFoundMode')]: notFoundMode, - }) { - const match = findFunction(ref, data, {mode: 'quiet'}); - - if (match === null && notFoundMode === 'exit') { - return continuation.exit(null); - } - - return continuation.raiseOutput({ - ['#resolvedReference']: match ?? null, - }); - }, + }) => continuation({ + ['#resolvedReference']: + findFunction(ref, data, {mode: 'quiet'}) ?? null, + }), }, ], }); -- cgit 1.3.0-6-gf8a5