import { CurriedFunction2 } from '../typings/types'; export type IterableReduceFunc = (previousValue: R, currentValue: T) => R; interface Reduce { (reducer: IterableReduceFunc, initialValue: R, iterable: Iterable): R; (reducer: IterableReduceFunc, initialValue: R): (iterable: Iterable) => R; (reducer: IterableReduceFunc): CurriedFunction2, R>; } /** * Returns a single item by iterating through the iterable, successively calling * the iterable function and passing it an previousValue value and the current * value from the iterable, and then passing the result to the next call. * * @param {Function} reducer The iterable function. Receives two values, the previous element and the * current element from the iterable. * @param {*} initialValue The initial value. * @param {Array} iterable The iterable target to iterate over. * @return {*} The final, accumulated value. * @example * * const numbers = [1, 2, 3]; * const plus = (a, b) => a + b; * * reduce(plus, 10, numbers); //=> 16 */ export declare const reduce: Reduce; export default reduce;