format export class Analysis { protected componentOrderKeyMap : { [ key ] : any ; } = { } ; constructor ( protected readonly parsedObj , protected readonly dependenciesMap ) { } private getComponentOrderKeyMap ( projKeys ) { projKeys . forEach ( ( key ) => { this . componentOrderKeyMap [ key ] = 1 ; } ) ; } private calculateOrderNumber ( componentKeys ) { componentKeys . forEach ( ( key ) => { const dependenciesInstance = this . dependenciesMap [ key ] ; Object . keys ( dependenciesInstance ) . forEach ( _key => { if ( this . componentOrderKeyMap [ _key ] ) { this . componentOrderKeyMap [ _key ] += dependenciesInstance [ _key ] ; } } ) ; } ) ; } getProjectOrder ( ) { const componentKeys = Object . keys ( this . dependenciesMap ) . filter ( key => key !== 'Global' ) ; this . getComponentOrderKeyMap ( componentKeys ) ; this . calculateOrderNumber ( componentKeys ) ; const projectArray = Object . keys ( this . componentOrderKeyMap ) . map ( key => { return { name : key , order : this . componentOrderKeyMap [ key ] } ; } ) ; return projectArray . sort ( ( item1 , item2 ) => { return item2 . order - item1 . order ; } ) . map ( item => item . name ) ; } }