source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/reduce.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 613 bytes
Line 
1import { scan } from './scan';
2import { takeLast } from './takeLast';
3import { defaultIfEmpty } from './defaultIfEmpty';
4import { pipe } from '../util/pipe';
5export function reduce(accumulator, seed) {
6 if (arguments.length >= 2) {
7 return function reduceOperatorFunctionWithSeed(source) {
8 return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);
9 };
10 }
11 return function reduceOperatorFunction(source) {
12 return pipe(scan((acc, value, index) => accumulator(acc, value, index + 1)), takeLast(1))(source);
13 };
14}
15//# sourceMappingURL=reduce.js.map
Note: See TracBrowser for help on using the repository browser.