This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm2015/internal/operators/reduce.js

15 lines
613 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
import { scan } from './scan';
import { takeLast } from './takeLast';
import { defaultIfEmpty } from './defaultIfEmpty';
import { pipe } from '../util/pipe';
export function reduce(accumulator, seed) {
if (arguments.length >= 2) {
return function reduceOperatorFunctionWithSeed(source) {
return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);
};
}
return function reduceOperatorFunction(source) {
return pipe(scan((acc, value, index) => accumulator(acc, value, index + 1)), takeLast(1))(source);
};
}
//# sourceMappingURL=reduce.js.map