function each
thefrontside/effectionConsume an Effection stream or subscription using a for...of loop.
Given any stream or subscription, you can access its values sequentially
using the each() operation, just as you would use a for await...of loop
with an async iterable:
Examples
Example 1
function* logValues(streamOrSubscription) {
for (let value of yield* each(streamOrSubscription)) {
console.log(value);
yield* each.next();
}
}
Pass an existing subscription when it must be active before iteration begins.
You must always invoke each.next() at the end of each iteration of the loop,
including if the iteration ends with a continue statement.
Note that just as with async iterators, there is no way to consume the
TClose value of a stream or subscription using the for...of loop.
Type Parameters
T the type of each value.
Parameters
source: Stream<T, unknown> | Subscription<T, unknown>
the stream or subscription to iterate
Return Type
Operation<Iterable<T>>
an operation that iterates source