« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/thing.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/thing.js')
-rw-r--r--src/data/things/thing.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 79d8ae0e..0f47dc90 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -15,6 +15,7 @@ import {
   exposeDependency,
   exposeDependencyOrContinue,
   raiseWithoutDependency,
+  withResultOfAvailabilityCheck,
   withUpdateValueAsDependency,
 } from '#composite';
 
@@ -297,15 +298,11 @@ export function singleReference({
 
 // Nice 'n simple shorthand for an exposed-only flag which is true when any
 // contributions are present in the specified property.
-export function contribsPresent(contribsProperty) {
-  return {
-    flags: {expose: true},
-    expose: {
-      dependencies: [contribsProperty],
-      compute: ({[contribsProperty]: contribs}) =>
-        !empty(contribs),
-    },
-  };
+export function contribsPresent({contribs}) {
+  return compositeFrom(`contribsPresent`, [
+    withResultOfAvailabilityCheck({fromDependency: contribs, mode: 'empty'}),
+    exposeDependency({dependency: '#availability'}),
+  ]);
 }
 
 // Neat little shortcut for "reversing" the reference lists stored on other