Creates a pipe.
Brackets a feed, the tasks chained to it and the Sink optionally closing them, declaring the composition a pipe so that it reads as one unit rather than as a run of juxtaposed calls.
The type of the composition, either the Feed a pipe left open ends with or the promise the closing sink reports
The composition to bracket
source, as handed in: a feed ready for manual iteration, or a promise resolving to the result the closing sink computes over the items
source
await pipe( (items([1, 2, 3])) (map(n => n*2)) (toArray())); // [2, 4, 6], as the closing sink resolves the pipefor await (const item of pipe( (range(1, 4)) (map(n => n*2)))) { console.log(item); // 2, 4, 6, drawn from the feed a pipe left open ends with} Copy
await pipe( (items([1, 2, 3])) (map(n => n*2)) (toArray())); // [2, 4, 6], as the closing sink resolves the pipefor await (const item of pipe( (range(1, 4)) (map(n => n*2)))) { console.log(item); // 2, 4, 6, drawn from the feed a pipe left open ends with}
Creates a pipe.
Brackets a feed, the tasks chained to it and the Sink optionally closing them, declaring the composition a pipe so that it reads as one unit rather than as a run of juxtaposed calls.