Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
797 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var scan_1 = require("./scan");
|
---|
4 | var takeLast_1 = require("./takeLast");
|
---|
5 | var defaultIfEmpty_1 = require("./defaultIfEmpty");
|
---|
6 | var pipe_1 = require("../util/pipe");
|
---|
7 | function reduce(accumulator, seed) {
|
---|
8 | if (arguments.length >= 2) {
|
---|
9 | return function reduceOperatorFunctionWithSeed(source) {
|
---|
10 | return pipe_1.pipe(scan_1.scan(accumulator, seed), takeLast_1.takeLast(1), defaultIfEmpty_1.defaultIfEmpty(seed))(source);
|
---|
11 | };
|
---|
12 | }
|
---|
13 | return function reduceOperatorFunction(source) {
|
---|
14 | return pipe_1.pipe(scan_1.scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast_1.takeLast(1))(source);
|
---|
15 | };
|
---|
16 | }
|
---|
17 | exports.reduce = reduce;
|
---|
18 | //# sourceMappingURL=reduce.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.