« get me outta code hell

exposeDependency.js « control-flow « composite « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/control-flow/exposeDependency.js
blob: 3aa3d03a7f0a51e9339b950ea70e13c3839bcb1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Exposes a dependency exactly as it is; this is typically the base of a
// composition which was created to serve as one property's descriptor.
//
// Please note that this *doesn't* verify that the dependency exists, so
// if you provide the wrong name or it hasn't been set by a previous
// compositional step, the property will be exposed as undefined instead
// of null.

import {input, templateCompositeFrom} from '#composite';

export default templateCompositeFrom({
  annotation: `exposeDependency`,

  compose: false,

  inputs: {
    dependency: input.staticDependency({acceptsNull: true}),
  },

  steps: () => [
    {
      dependencies: [input('dependency')],
      compute: ({
        [input('dependency')]: dependency
      }) => dependency,
    },
  ],
});