import { CurriedFunction2 } from '../typings/types'; export type ReduceFunc = (acc: R, elem: T, index: number, arr: ArrayLike) => R; interface Reduce { (fn: ReduceFunc, acc: R, list: ArrayLike): R; (fn: ReduceFunc, acc: R): (list: ArrayLike) => R; (fn: ReduceFunc): CurriedFunction2, R>; } /** * Returns a single item by iterating through the list, successively calling * the iterator function and passing it an accumulator value and the current * value from the array, and then passing the result to the next call. * * @param {Function} fn The iterator function. Receives two values, the accumulator and the * current element from the array. * @param {*} acc The accumulator value. * @param {Array} arr The list to iterate over. * @return {*} The final, accumulated value. * @example * * var numbers = [1, 2, 3]; * var plus = (a, b) => a + b; * * reduce(plus, 10, numbers); //=> 16 */ declare const _default: Reduce; export default _default;