import predicateType from '../helpers/predicateType'; /** * Reduces a collection to a single value by iterating over the elements of the collection. * * @since 1.0.0 * * @template T * @param {Array | Object} collection - The collection to iterate over. * @param {Function} [iteratee=identity] - The function invoked per iteration. * @param {*} [initialValue] - The initial value. * @returns {*} - Returns the accumulated value. * * @example * reduce([1, 2, 3], (acc, n) => acc + n); // => 6 * * reduce( * { a: 1, b: 2, c: 1 }, * (result, value, key) => { * (result[value] || (result[value] = [])).push(key); * return result; * }, * {} * ); * // => { '1': ['a', 'c'], '2': ['b'] } */ declare const reduce: (collection: Object | T[], iteratee: predicateType | undefined, initialValue: any) => T; export default reduce;