mirror of
				https://github.com/ZetaKebab/quartz.git
				synced 2025-11-04 06:49:49 +00:00 
			
		
		
		
	fix(explorer): filter function in ExplorerNode
				
					
				
			This commit is contained in:
		@@ -76,18 +76,8 @@ export class FileNode {
 | 
			
		||||
   * @param filterFn function to filter tree with
 | 
			
		||||
   */
 | 
			
		||||
  filter(filterFn: (node: FileNode) => boolean) {
 | 
			
		||||
    const filteredNodes: FileNode[] = []
 | 
			
		||||
 | 
			
		||||
    const traverse = (node: FileNode) => {
 | 
			
		||||
      if (filterFn(node)) {
 | 
			
		||||
        filteredNodes.push(node)
 | 
			
		||||
      }
 | 
			
		||||
      node.children.forEach(traverse)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    traverse(this)
 | 
			
		||||
 | 
			
		||||
    this.children = filteredNodes
 | 
			
		||||
    this.children = this.children.filter(filterFn)
 | 
			
		||||
    this.children.forEach((child) => child.filter(filterFn))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user