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
29
30
31
32
33
34
35
36
37
38
39
40
|
// Performs the same availability check across all items of a list, providing
// a list that's suitable anywhere a filter is expected.
//
// Accepts the same mode options as withResultOfAvailabilityCheck.
//
// See also:
// - withFilteredList
// - withResultOfAvailabilityCheck
//
import {input, templateCompositeFrom} from '#composite';
import inputAvailabilityCheckMode from './inputAvailabilityCheckMode.js';
import performAvailabilityCheck from './helpers/performAvailabilityCheck.js';
export default templateCompositeFrom({
annotation: `withAvailabilityFilter`,
inputs: {
from: input({type: 'array'}),
mode: inputAvailabilityCheckMode(),
},
outputs: ['#availabilityFilter'],
steps: () => [
{
dependencies: [input('from'), input('mode')],
compute: (continuation, {
[input('from')]: list,
[input('mode')]: mode,
}) => continuation({
['#availabilityFilter']:
list.map(value =>
performAvailabilityCheck(value, mode)),
}),
},
],
});
|