import { TreeElement } from "../../../../classes/TreeElement" ; import VisualizationOptionStore from "../../../../stores/VisualizationOptionStore" ; import { lazyInject } from "../../../../inversify.config" ; export default class SonarQubeFilterStructureService { @ lazyInject ( "VisualizationOptionStore" ) private readonly visualizationOptions ! : VisualizationOptionStore ; public filter ( element ) { if ( element . isFile ( ) || element . children . length === 0 ) { return ; } for ( let index = element . children . length ; index -- ; ) { this . processChild ( element . children , index ) ; } } private processChild ( children , index ) { const child = children [ index ] ; if ( child . isFile ( ) ) { if ( this . visualizationOptions . fileFilter . shouldRemoveFile ( child ) ) { children . splice ( index , 1 ) ; } } else { this . filter ( child ) ; } } }