Commit 086c4bf 1 parent a1b0e52 commit 086c4bf Copy full SHA for 086c4bf
File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { Operator } from '../Operator' ;
2
2
import { Subscriber } from '../Subscriber' ;
3
- import { tryCatch } from '../util/tryCatch' ;
4
- import { errorObject } from '../util/errorObject' ;
5
3
import { Observable } from '../Observable' ;
6
4
7
5
/**
@@ -35,12 +33,17 @@ class FilterSubscriber<T> extends Subscriber<T> {
35
33
this . select = select ;
36
34
}
37
35
38
- protected _next ( x : T ) {
39
- const result = tryCatch ( this . select ) . call ( this . thisArg || this , x , this . count ++ ) ;
40
- if ( result === errorObject ) {
41
- this . destination . error ( errorObject . e ) ;
42
- } else if ( Boolean ( result ) ) {
43
- this . destination . next ( x ) ;
36
+ // the try catch block below is left specifically for
37
+ // optimization and perf reasons. a tryCatcher is not necessary here.
38
+ next ( value : T ) {
39
+ let result : any ;
40
+ try {
41
+ result = this . select . call ( this . thisArg , value , this . count ++ ) ;
42
+ } catch ( err ) {
43
+ this . destination . error ( err ) ;
44
+ }
45
+ if ( result ) {
46
+ this . destination . next ( value ) ;
44
47
}
45
48
}
46
49
}
You can’t perform that action at this time.
0 commit comments