Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / src / internal / operators / exhaustMap.ts
index 3bf6ff4a410d0086168b2be236a5016d99598155..9a50669c22029cc157103f22b8065c6feea7f0a9 100644 (file)
@@ -2,12 +2,10 @@ import { Operator } from '../Operator';
 import { Observable } from '../Observable';
 import { Subscriber } from '../Subscriber';
 import { Subscription } from '../Subscription';
-import { OuterSubscriber } from '../OuterSubscriber';
-import { InnerSubscriber } from '../InnerSubscriber';
-import { subscribeToResult } from '../util/subscribeToResult';
 import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
 import { map } from './map';
 import { from } from '../observable/from';
+import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
 
 /* tslint:disable:max-line-length */
 export function exhaustMap<T, O extends ObservableInput<any>>(project: (value: T, index: number) => O): OperatorFunction<T, ObservedValueOf<O>>;
@@ -92,7 +90,7 @@ class ExhaustMapOperator<T, R> implements Operator<T, R> {
  * @ignore
  * @extends {Ignored}
  */
-class ExhaustMapSubscriber<T, R> extends OuterSubscriber<T, R> {
+class ExhaustMapSubscriber<T, R> extends SimpleOuterSubscriber<T, R> {
   private hasSubscription = false;
   private hasCompleted = false;
   private index = 0;
@@ -114,18 +112,18 @@ class ExhaustMapSubscriber<T, R> extends OuterSubscriber<T, R> {
     try {
       result = this.project(value, index);
     } catch (err) {
-      this.destination.error(err);
+      this.destination.error!(err);
       return;
     }
     this.hasSubscription = true;
-    this._innerSub(result, value, index);
+    this._innerSub(result);
   }
 
-  private _innerSub(result: ObservableInput<R>, value: T, index: number): void {
-    const innerSubscriber = new InnerSubscriber(this, value, index);
+  private _innerSub(result: ObservableInput<R>): void {
+    const innerSubscriber = new SimpleInnerSubscriber(this);
     const destination = this.destination as Subscription;
     destination.add(innerSubscriber);
-    const innerSubscription = subscribeToResult<T, R>(this, result, undefined, undefined, innerSubscriber);
+    const innerSubscription = innerSubscribe(result, innerSubscriber);
     // The returned subscription will usually be the subscriber that was
     // passed. However, interop subscribers will be wrapped and for
     // unsubscriptions to chain correctly, the wrapper needs to be added, too.
@@ -137,28 +135,23 @@ class ExhaustMapSubscriber<T, R> extends OuterSubscriber<T, R> {
   protected _complete(): void {
     this.hasCompleted = true;
     if (!this.hasSubscription) {
-      this.destination.complete();
+      this.destination.complete!();
     }
     this.unsubscribe();
   }
 
-  notifyNext(outerValue: T, innerValue: R,
-             outerIndex: number, innerIndex: number,
-             innerSub: InnerSubscriber<T, R>): void {
-    this.destination.next(innerValue);
+  notifyNext(innerValue: R): void {
+    this.destination.next!(innerValue);
   }
 
   notifyError(err: any): void {
-    this.destination.error(err);
+    this.destination.error!(err);
   }
 
-  notifyComplete(innerSub: Subscription): void {
-    const destination = this.destination as Subscription;
-    destination.remove(innerSub);
-
+  notifyComplete(): void {
     this.hasSubscription = false;
     if (this.hasCompleted) {
-      this.destination.complete();
+      this.destination.complete!();
     }
   }
 }