//#region src/Array/reduce.d.ts /** * # reduce * * ```ts * function Array.reduce( * target: readonly T[], * acc: U, * reducer: ( * acc: NoInfer, * value: NoInfer, * idx: number, * target: readonly NoInfer[], * ) => NoInfer, * ): U * ``` * * Reduces `array` to a single value by executing the `reducer` function on each element, starting with the `initial` accumulator value. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.reduce([1, 2, 3, 4], 0, (acc, x) => acc + x); // 10 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3, 4], * Array.reduce(0, (acc, x) => acc + x), * ); // 10 * ``` * */ declare const reduce: { (acc: U, reducer: (acc: NoInfer, value: NoInfer, idx: number, target: readonly NoInfer[]) => NoInfer): (target: readonly T[]) => U; (target: readonly T[], acc: U, reducer: (acc: NoInfer, value: NoInfer, idx: number, target: readonly NoInfer[]) => NoInfer): U; }; //#endregion export { reduce };