This repository was archived by the owner on Oct 1, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
src/app/operators/components/operator Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export const OPERATOR_TOKEN = new InjectionToken<string>('operators');
2020} )
2121export class OperatorComponent implements OnInit {
2222 public operator : OperatorDoc ;
23- public operatorsMap : { string ?: OperatorDoc } ;
23+ public operatorsMap = new Map < string , OperatorDoc > ( ) ;
2424
2525 private readonly baseSourceUrl = 'https://github.com/ReactiveX/rxjs/blob/master/src/operators/' ;
2626 private readonly baseSpecUrl = 'http://reactivex.io/rxjs/test-file/spec-js/operators' ;
@@ -33,19 +33,14 @@ export class OperatorComponent implements OnInit {
3333 ) { }
3434
3535 ngOnInit ( ) {
36- this . operatorsMap = this . operators . reduce (
37- ( acc : { string ?: OperatorDoc } , value : OperatorDoc ) => {
38- acc [ value . name ] = value ;
39- return acc ;
40- } ,
41- { }
42- ) ;
43-
36+ this . operators . forEach ( ( op : OperatorDoc ) => {
37+ this . operatorsMap . set ( op . name , op ) ;
38+ } ) ;
4439 this . _activatedRoute . params
4540 . pipe ( pluck ( 'operator' ) )
4641 . subscribe ( ( name : string ) => {
47- if ( name in this . operatorsMap ) {
48- this . operator = this . operatorsMap [ name ] ;
42+ if ( this . operatorsMap . has ( name ) ) {
43+ this . operator = this . operatorsMap . get ( name ) ;
4944 } else {
5045 this . notfound ( ) ;
5146 return ;
You can’t perform that action at this time.
0 commit comments