switchScan.js 512 B

123456789101112
  1. import { switchMap } from './switchMap';
  2. import { operate } from '../util/lift';
  3. export function switchScan(accumulator, seed) {
  4. return operate(function (source, subscriber) {
  5. var state = seed;
  6. switchMap(function (value, index) { return accumulator(state, value, index); }, function (_, innerValue) { return ((state = innerValue), innerValue); })(source).subscribe(subscriber);
  7. return function () {
  8. state = null;
  9. };
  10. });
  11. }
  12. //# sourceMappingURL=switchScan.js.map