Async function that returns the chain as an array of values
Calls callback
whenever the chain/generator produces a value.
Treats the chain/generator as a promise
Returns the most recent value from the chain/generator, or
initialValue
(defaulting to undefined) if no value
has been emitted yet.
Monitors sources, storing as they happen to an array. Whenever a new value is emitted, the whole array is sent out, containing current values from each source, or undefined if not yet emitted.
Monitors sources, storing as they happen to an object. Whenever a new value is emitted, the object is sent out, containing current values from each source, or undefined if not yet emitted.
Merge values from several sources into one stream, interleaving values. When all streams are complete it finishes.
Prepare a chain, allowing you to provide a source at execution time.
const chain = Chains.prepare(
Chains.transform<string,number>( v => Number.parseInt(v) ),
Chains.filter<number>(v => v % 2 === 0)
Resolve the data, primitive or function to an AsyncGenerator
Resolve the array, data or function to a Generator
Chain functions together. First argument is the source. Use runN if you want to chain more links than is possible here, at the cost of poorer type hinting.
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.
Input a single value to the chain, return a single result
Waits for all sources to produce a value, sending the combined results as an array. After sending, it waits again for each source to send at least one value.
Delay options
A Generator, AsyncGenerator or IterableIterator
A function which can start a chain, since it takes no input
Some kind of (async) generator or an array of data of type V
Lazy execution of a chain
A function which can form part of a chain. It takes an input GenOrData, and returns a new generator.
An array of chain links where first one is a source
Adds values to the provided array as they are produced, mutating array.