From edf2f46d0778b9505258cde878742b816289d1f6 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 10 Apr 2024 20:24:34 -0300 Subject: data, content: various property & thing-type matches --- .../things/contribution/thingPropertyMatches.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/data/composite/things/contribution/thingPropertyMatches.js (limited to 'src/data/composite/things/contribution/thingPropertyMatches.js') diff --git a/src/data/composite/things/contribution/thingPropertyMatches.js b/src/data/composite/things/contribution/thingPropertyMatches.js new file mode 100644 index 00000000..4a37f2cf --- /dev/null +++ b/src/data/composite/things/contribution/thingPropertyMatches.js @@ -0,0 +1,33 @@ +import {input, templateCompositeFrom} from '#composite'; + +import {exitWithoutDependency} from '#composite/control-flow'; + +export default templateCompositeFrom({ + annotation: `thingPropertyMatches`, + + compose: false, + + inputs: { + value: input({type: 'string'}), + }, + + steps: () => [ + exitWithoutDependency({ + dependency: 'thingProperty', + value: input.value(false), + }), + + { + dependencies: [ + 'thingProperty', + input('value'), + ], + + compute: ({ + ['thingProperty']: thingProperty, + [input('value')]: value, + }) => + thingProperty === value, + }, + ], +}); -- cgit 1.3.0-6-gf8a5