sequency
Version:
Functional sequences for processing iterable data in JavaScript
15 lines (14 loc) • 698 B
TypeScript
import Sequence from "./Sequence";
export declare class FoldIndexed {
/**
* Accumulates all elements of the sequence into a single result by applying the given `operation` starting with
* the `initial` value. The result of the last operation will be passed as accumulated value to the getNext invocation
* of the operation as well as the `index` of the current element (zero-based) until all elements of the sequence
* are processed.
*
* @param {R} initial
* @param {(index: number, acc: R, element: T) => R} operation
* @returns {R}
*/
foldIndexed<T, R>(this: Sequence<T>, initial: R, operation: (index: number, acc: R, element: T) => R): R;
}