aboutsummaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts')
-rw-r--r--tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts26
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts b/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts
index 33dde3bb38..de5ddadbee 100644
--- a/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts
+++ b/tools/node_modules/eslint/node_modules/rxjs/src/internal/operators/expand.ts
@@ -1,8 +1,6 @@
import { Observable } from '../Observable';
import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
-import { tryCatch } from '../util/tryCatch';
-import { errorObject } from '../util/errorObject';
import { Subscription } from '../Subscription';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
@@ -37,6 +35,9 @@ export function expand<T>(project: (value: T, index: number) => ObservableInput<
* ## Example
* Start emitting the powers of two on every click, at most 10 of them
* ```javascript
+ * import { fromEvent, of } from 'rxjs';
+ * import { expand, mapTo, delay, take } from 'rxjs/operators';
+ *
* const clicks = fromEvent(document, 'click');
* const powersOfTwo = clicks.pipe(
* mapTo(1),
@@ -126,15 +127,18 @@ export class ExpandSubscriber<T, R> extends OuterSubscriber<T, R> {
const index = this.index++;
if (this.active < this.concurrent) {
destination.next(value);
- let result = tryCatch(this.project)(value, index);
- if (result === errorObject) {
- destination.error(errorObject.e);
- } else if (!this.scheduler) {
- this.subscribeToProjection(result, value, index);
- } else {
- const state: DispatchArg<T, R> = { subscriber: this, result, value, index };
- const destination = this.destination as Subscription;
- destination.add(this.scheduler.schedule<DispatchArg<T, R>>(ExpandSubscriber.dispatch, 0, state));
+ try {
+ const { project } = this;
+ const result = project(value, index);
+ if (!this.scheduler) {
+ this.subscribeToProjection(result, value, index);
+ } else {
+ const state: DispatchArg<T, R> = { subscriber: this, result, value, index };
+ const destination = this.destination as Subscription;
+ destination.add(this.scheduler.schedule<DispatchArg<T, R>>(ExpandSubscriber.dispatch, 0, state));
+ }
+ } catch (e) {
+ destination.error(e);
}
} else {
this.buffer.push(value);