1 /** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */
2 import { scan } from './scan';
3 import { takeLast } from './takeLast';
4 import { defaultIfEmpty } from './defaultIfEmpty';
5 import { pipe } from '../util/pipe';
6 export function reduce(accumulator, seed) {
7 if (arguments.length >= 2) {
8 return function reduceOperatorFunctionWithSeed(source) {
9 return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);
12 return function reduceOperatorFunction(source) {
13 return pipe(scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast(1))(source);
16 //# sourceMappingURL=reduce.js.map