« get me outta code hell

exposeConstant.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/exposeConstant.js
blob: e04354787f189a0e1dd825f670a7fbde2620332f (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
// Exposes a constant value exactly as it is; like exposeDependency, this
// is typically the base of a composition serving as a particular property
// descriptor. It generally follows steps which will conditionally early
// exit with some other value, with the exposeConstant base serving as the
// fallback default value.

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

export default templateCompositeFrom({
  annotation: `exposeConstant`,

  compose: false,

  inputs: {
    value: input.staticValue(),
  },

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