scanInternals.js 979 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.scanInternals = void 0;
  4. var OperatorSubscriber_1 = require("./OperatorSubscriber");
  5. function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
  6. return function (source, subscriber) {
  7. var hasState = hasSeed;
  8. var state = seed;
  9. var index = 0;
  10. source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
  11. var i = index++;
  12. state = hasState
  13. ?
  14. accumulator(state, value, i)
  15. :
  16. ((hasState = true), value);
  17. emitOnNext && subscriber.next(state);
  18. }, emitBeforeComplete &&
  19. (function () {
  20. hasState && subscriber.next(state);
  21. subscriber.complete();
  22. })));
  23. };
  24. }
  25. exports.scanInternals = scanInternals;
  26. //# sourceMappingURL=scanInternals.js.map