File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -30,19 +30,11 @@ export class Injector {
3030 }
3131
3232 get ( token ) {
33- return this . getByKey ( Key . get ( token ) ) ;
33+ return this . _getByKey ( Key . get ( token ) , false , false ) ;
3434 }
3535
3636 asyncGet ( token ) {
37- return this . asyncGetByKey ( Key . get ( token ) ) ;
38- }
39-
40- getByKey ( key :Key ) {
41- return this . _getByKey ( key , false , false ) ;
42- }
43-
44- asyncGetByKey ( key :Key ) {
45- return this . _getByKey ( key , true , false ) ;
37+ return this . _getByKey ( Key . get ( token ) , true , false ) ;
4638 }
4739
4840 createChild ( bindings :List ) :Injector {
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export class Key {
1313 }
1414
1515 static get ( token ) {
16+ if ( token instanceof Key ) return token ;
17+
1618 if ( MapWrapper . contains ( _allKeys , token ) ) {
1719 return MapWrapper . get ( _allKeys , token )
1820 }
Original file line number Diff line number Diff line change @@ -10,5 +10,9 @@ export function main() {
1010 it ( 'should not be equal to another key if types are different' , function ( ) {
1111 expect ( Key . get ( 'car' ) ) . not . toBe ( Key . get ( 'porsche' ) ) ;
1212 } ) ;
13+
14+ it ( 'should return the passed in key' , function ( ) {
15+ expect ( Key . get ( Key . get ( 'car' ) ) ) . toBe ( Key . get ( 'car' ) ) ;
16+ } ) ;
1317 } ) ;
1418}
You can’t perform that action at this time.
0 commit comments