UNPKG

900 BTypeScriptView Raw
1import { ReduceOptions } from './reduceoptions';
2/**
3 * Applies an accumulator function over an async-iterable sequence, returning the result of the aggregation as a
4 * single element in the result sequence. The seed value, if specified, is used as the initial accumulator value.
5 * For aggregation behavior with incremental intermediate results, scan.
6 *
7 * @export
8 * @template T The type of the elements in the source sequence.
9 * @template R The type of the result of the aggregation.
10 * @param {AsyncIterable<T>} source An async-iterable sequence to aggregate over.
11 * @param {ReduceOptions<T, R>} options The options which contains a callback, with optional seedn and an optional abort signal for cancellation.
12 * @returns {Promise<R>} A promise with the final accumulator value.
13 */
14export declare function reduce<T, R = T>(source: AsyncIterable<T>, options: ReduceOptions<T, R>): Promise<R>;