Creates a sink averaging the items of the feed.
Creates a sink counting the items of the feed.
Creates a sink reporting whether every item matches a predicate.
Creates a sink retrieving the first item matching a predicate.
Creates a sink handing every item to a consumer.
Creates a sink selecting the greatest item of the feed.
Creates a sink selecting the least item of the feed.
Creates a sink reducing the feed to a single value, with or without an initial value.
Creates a sink reporting whether some item matches a predicate.
Creates a sink summing the items of the feed.
Creates a sink collecting the items of the feed into an array.
Creates a sink collecting items or extracted values into a map under extracted keys.
Creates a sink collecting items or extracted values into a deeply immutable object under extracted keys.
Creates a sink collecting the distinct items of the feed into a set.
Creates a sink joining the items of the feed into a string.
Terminal operations that consume feeds and produce final results.
Sinks close a pipe: applying one to a Feed triggers execution and returns a promise resolving to the final result. Those that can decide their outcome early stop consuming rather than draining the source, while those collecting items into a container return it deeply immutable, freezing the container together with the items, keys and values collected into it. Those reducing the feed to a single value, whether computed over its items or selected among them, resolve to
undefinedwhen the feed carries none and no result is defined, leaving the choice of a fallback to the caller.Custom Sinks are functions that consume async iterables by returning a promise for the final result: