integers, and then filtering only even numbers.
const ch = Chains.runN(
[ `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10` ],
Chains.transform<string, number>(v => Number.parseInt(v)),
Chains.filter(v => v % 2 === 0)
);
const output = await Async.toArray(ch2);
// [ 2, 4, 6, 8, 10 ]
const c1 = Chains.run(
Chains.fromEvent(window, `pointermove`),
Chains.Links.transform(event => ({ x: event.x, y: event.y }))
);
// Eg: print out data as it comes in
Iterables.forEach(c1, coord => {
console.log(coord);
});
// Execution continues immediately
Chain functions together. First argument is the source.
runN
takes any number of chain functions. Use run if possible, because it has improved type hinting.