switchScan.js 662 B

12345678910111213141516
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.switchScan = void 0;
  4. var switchMap_1 = require("./switchMap");
  5. var lift_1 = require("../util/lift");
  6. function switchScan(accumulator, seed) {
  7. return lift_1.operate(function (source, subscriber) {
  8. var state = seed;
  9. switchMap_1.switchMap(function (value, index) { return accumulator(state, value, index); }, function (_, innerValue) { return ((state = innerValue), innerValue); })(source).subscribe(subscriber);
  10. return function () {
  11. state = null;
  12. };
  13. });
  14. }
  15. exports.switchScan = switchScan;
  16. //# sourceMappingURL=switchScan.js.map