@@ -13,7 +13,7 @@ import { Types, Core, Targets } from '../constants';
1313import { events , EventEmitter } from './api/events' ;
1414import { Logger } from './Logger' ;
1515import { IocConfig } from '../config/IocConfig' ;
16- import { getFolderwrapping } from './helpers/Path' ;
16+ import { getFolderWrapping } from './helpers/Path' ;
1717
1818
1919export class IoC {
@@ -122,16 +122,16 @@ export class IoC {
122122 . whenTargetNamed ( name ) ;
123123 }
124124
125- private bindFiles ( path : string , target : any , callback : ( name : any , value : any ) => void ) : Promise < void > {
125+ private bindFiles ( filePath : string , target : any , callback : ( name : any , value : any ) => void ) : Promise < void > {
126126 return new Promise < void > ( ( resolve ) => {
127- this . getFiles ( path , ( files : string [ ] ) => {
127+ this . getFiles ( filePath , ( files : string [ ] ) => {
128128 files . forEach ( ( file : any ) => {
129129 let fileExport ;
130130 let fileClass ;
131131 let fileTarget ;
132132 const isRecursive = file . name . indexOf ( '.' ) > 0 ;
133133 try {
134- fileExport = require ( `${ file . path } ` ) ;
134+ fileExport = require ( `${ file . filePath } ` ) ;
135135 } catch ( e ) {
136136 this . log . warn ( e . message ) ;
137137 return ;
@@ -185,32 +185,31 @@ export class IoC {
185185 }
186186
187187 private getBasePath ( ) : string {
188- const baseFolder = __dirname . indexOf ( getFolderwrapping ( 'src' ) ) >= 0 ? getFolderwrapping ( 'src' ) : getFolderwrapping ( 'dist' ) ;
188+ const baseFolder = __dirname . indexOf ( getFolderWrapping ( 'src' ) ) >= 0 ? getFolderWrapping ( 'src' ) : getFolderWrapping ( 'dist' ) ;
189189 const baseRoot = __dirname . substring ( 0 , __dirname . indexOf ( baseFolder ) ) ;
190190 return path . join ( baseRoot , baseFolder , 'api' ) ;
191191 }
192192
193- private getFiles ( path : string , done : ( files : any [ ] ) => void ) : void {
194- const isTypeScript = __dirname . indexOf ( getFolderwrapping ( 'src' ) ) >= 0 ;
193+ private getFiles ( filePath : string , done : ( files : any [ ] ) => void ) : void {
194+ const isTypeScript = __dirname . indexOf ( getFolderWrapping ( 'src' ) ) >= 0 ;
195195 if ( ! isTypeScript ) {
196- path = path . replace ( '.ts' , '.js' ) ;
196+ filePath = filePath . replace ( '.ts' , '.js' ) ;
197197 }
198- glob ( this . getBasePath ( ) + path , ( err : any , files : string [ ] ) => {
198+ glob ( this . getBasePath ( ) + filePath , ( err : any , files : string [ ] ) => {
199199 if ( err ) {
200- this . log . warn ( `Could not read the folder ${ path } !` ) ;
200+ this . log . warn ( `Could not read the folder ${ filePath } !` ) ;
201201 return ;
202202 }
203203 done ( files . map ( ( p : string ) => this . parseFilePath ( p ) ) ) ;
204204 } ) ;
205205 }
206206
207- private parseFilePath ( path : string ) : any {
208- const filePath = path . substring ( this . getBasePath ( ) . length + 1 ) ;
209- const dir = filePath . split ( '/' ) [ 0 ] ;
210- const file = filePath . substr ( dir . length + 1 ) ;
207+ private parseFilePath ( filePath : string ) : any {
208+ const p = filePath . substring ( this . getBasePath ( ) . length + 1 ) ;
209+ const dir = p . split ( '/' ) [ 0 ] ;
210+ const file = p . substr ( dir . length + 1 ) ;
211211 const name = file . replace ( '/' , '.' ) . substring ( 0 , file . length - 3 ) ;
212212 return {
213- path,
214213 filePath,
215214 dir,
216215 file,
0 commit comments