Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

reduce.js 797B

123456789101112131415161718
  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