@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
18 lines (17 loc) • 543 B
TypeScript
import { Accumulator } from '@johngw/stream-common/Function';
import { Flushable } from '@johngw/stream-common/Stream';
/**
* Reduces chunks in to one accumulator. Once the stream is cancelled,
* the accumulator will be queued.
*
* @group Transformers
* @see {@link accumulate:function}
* @example
*
* --a-------b-------c-----|
*
* reduce([], (acc, chunk) => [...acc, chunk])
*
* ------------------------[a,b,c]-|
*/
export declare function reduce<I, O>(acc: O, fn: Accumulator<I, O>, options?: Flushable): TransformStream<I, O>;