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:
718 bytes
|
Line | |
---|
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);
|
---|
10 | };
|
---|
11 | }
|
---|
12 | return function reduceOperatorFunction(source) {
|
---|
13 | return pipe(scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast(1))(source);
|
---|
14 | };
|
---|
15 | }
|
---|
16 | //# sourceMappingURL=reduce.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.