« 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: e76699c5ce745e8d0e91973490a8bc3d15e71fb2 (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({acceptsNull: true}),
  },

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