« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/things/composite.js31
-rw-r--r--src/data/things/thing.js2
-rw-r--r--src/data/things/track.js2
3 files changed, 17 insertions, 18 deletions
diff --git a/src/data/things/composite.js b/src/data/things/composite.js
index 84a98290..b9cd6bfb 100644
--- a/src/data/things/composite.js
+++ b/src/data/things/composite.js
@@ -104,7 +104,7 @@ import {
 // on a provided dependency name, and then providing a result in another
 // also-provided dependency name:
 //
-//   static Thing.composite.withResolvedContribs = ({
+//   withResolvedContribs = ({
 //     from: contribsByRefDependency,
 //     to: outputDependency,
 //   }) => ({
@@ -126,10 +126,11 @@ import {
 //
 // And how you might work that into a composition:
 //
-//   static Track[Thing.getPropertyDescriptors].coverArtists =
-//     Thing.composite.from([
-//       Track.composite.doSomethingWhichMightEarlyExit(),
-//       Thing.composite.withResolvedContribs({
+//   Track.coverArtists =
+//     compositeFrom([
+//       doSomethingWhichMightEarlyExit(),
+//
+//       withResolvedContribs({
 //         from: 'coverArtistContribsByRef',
 //         to: '#coverArtistContribs',
 //       }),
@@ -138,9 +139,8 @@ import {
 //         flags: {expose: true},
 //         expose: {
 //           dependencies: ['#coverArtistContribs'],
-//           compute({'#coverArtistContribs': coverArtistContribs}) {
-//             return coverArtistContribs.map(({who}) => who);
-//           },
+//           compute: ({'#coverArtistContribs': coverArtistContribs}) =>
+//             coverArtistContribs.map(({who}) => who),
 //         },
 //       },
 //     ]);
@@ -169,7 +169,7 @@ import {
 // Consider the `withResolvedContribs` example adjusted to make use of
 // two of these options below:
 //
-//   static Thing.composite.withResolvedContribs = ({
+//   withResolvedContribs = ({
 //     from: contribsByRefDependency,
 //     to: outputDependency,
 //   }) => ({
@@ -194,7 +194,7 @@ import {
 // With a little destructuring and restructuring JavaScript sugar, the
 // above can be simplified some more:
 //
-//   static Thing.composite.withResolvedContribs = ({from, to}) => ({
+//   withResolvedContribs = ({from, to}) => ({
 //     flags: {expose: true, compose: true},
 //     expose: {
 //       dependencies: ['artistData'],
@@ -281,7 +281,7 @@ import {
 //
 // In order to allow for this while helping to ensure internal dependencies
 // remain neatly isolated from the composition which nests your bundle,
-// the Thing.composite.from() function will accept and adapt to a base that
+// the compositeFrom() function will accept and adapt to a base that
 // specifies the {compose: true} flag, just like the steps preceding it.
 //
 // The continuation function that gets provided to the base will be mildly
@@ -341,8 +341,7 @@ import {
 // syntax as for other compositional steps, and it'll work out cleanly!
 //
 
-export {compositeFrom as from};
-function compositeFrom(firstArg, secondArg) {
+export function compositeFrom(firstArg, secondArg) {
   const debug = fn => {
     if (compositeFrom.debug === true) {
       const label =
@@ -373,7 +372,7 @@ function compositeFrom(firstArg, secondArg) {
 
   const aggregate = openAggregate({
     message:
-      `Errors preparing Thing.composite.from() composition` +
+      `Errors preparing composition` +
       (annotation ? ` (${annotation})` : ''),
   });
 
@@ -780,9 +779,9 @@ function compositeFrom(firstArg, secondArg) {
 //     t.same(thing.someProp, value)
 //
 //   With debugging:
-//     t.same(Thing.composite.debug(() => thing.someProp), value)
+//     t.same(debugComposite(() => thing.someProp), value)
 //
-export function debug(fn) {
+export function debugComposite(fn) {
   compositeFrom.debug = true;
   const value = fn();
   compositeFrom.debug = false;
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 93f19799..9b564ee9 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -9,7 +9,7 @@ import {empty, stitchArrays} from '#sugar';
 import {filterMultipleArrays, getKebabCase} from '#wiki-data';
 
 import {
-  from as compositeFrom,
+  compositeFrom,
   exitWithoutDependency,
   exposeDependency,
   raiseWithoutDependency,
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 9e1942e3..1818e003 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -5,7 +5,7 @@ import find from '#find';
 import {empty} from '#sugar';
 
 import {
-  from as compositeFrom,
+  compositeFrom,
   exitWithoutDependency,
   exposeConstant,
   exposeDependency,