UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

21 lines 692 B
import type { Accumulator } from '@johngw/stream-common/Function'; /** * Every chunk is transformed in to an accumulator. * * @group Transformers * @see {@link reduce:function} * @example * Accumulate all previous chunks with a counter. * ``` * --0-------------------------1------------------------------- * * accumulate({ chunks: [], counter: 0 }, (acc, chunk) => ({ * chunks: [...acc.chunks, chunk], * counter: acc.counter + 1 * })) * * ----{chunks:[0],counter:1}------{chunks:[0,1],counter:2}---- * ``` */ export declare function accumulate<I, O>(acc: O, fn: Accumulator<I, O>): import("node:stream/web").TransformStream<I, O>; //# sourceMappingURL=accumulate.d.ts.map