File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ class FilterSubscriber<T> extends Subscriber<T> {
41
41
result = this . select . call ( this . thisArg , value , this . count ++ ) ;
42
42
} catch ( err ) {
43
43
this . destination . error ( err ) ;
44
+ return ;
44
45
}
45
46
if ( result ) {
46
47
this . destination . next ( value ) ;
Original file line number Diff line number Diff line change 1
1
import { Operator } from '../Operator' ;
2
2
import { Observable } from '../Observable' ;
3
3
import { Subscriber } from '../Subscriber' ;
4
- import { tryCatch } from '../util/tryCatch' ;
5
- import { errorObject } from '../util/errorObject' ;
6
4
7
5
/**
8
6
* Returns an Observable that applies a specified accumulator function to each item emitted by the source Observable.
@@ -49,18 +47,23 @@ class ScanSubscriber<T, R> extends Subscriber<T> {
49
47
this . accumulatorSet = typeof seed !== 'undefined' ;
50
48
}
51
49
52
- protected _next ( value : T ) : void {
50
+ next ( value : T ) : void {
53
51
if ( ! this . accumulatorSet ) {
54
52
this . seed = value ;
55
53
this . destination . next ( value ) ;
56
54
} else {
57
- const result = tryCatch ( this . accumulator ) . call ( this , this . seed , value ) ;
58
- if ( result === errorObject ) {
59
- this . destination . error ( errorObject . e ) ;
60
- } else {
61
- this . seed = result ;
62
- this . destination . next ( this . seed ) ;
63
- }
55
+ return this . _tryNext ( value ) ;
64
56
}
65
57
}
58
+
59
+ private _tryNext ( value : T ) : void {
60
+ let result : any ;
61
+ try {
62
+ result = this . accumulator ( < R > this . seed , value ) ;
63
+ } catch ( err ) {
64
+ this . destination . error ( err ) ;
65
+ }
66
+ this . seed = result ;
67
+ this . destination . next ( result ) ;
68
+ }
66
69
}
You can’t perform that action at this time.
0 commit comments