File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -475,7 +475,7 @@ export const countObjectNameAppearances = async (
475
475
path : string ,
476
476
originalName : string
477
477
) : Promise < number > => {
478
- let counter : number = 0 ;
478
+ let dirCount : { [ fileName : string ] : number } = { } ;
479
479
path = path . substring ( 0 , path . lastIndexOf ( '/' ) ) ;
480
480
481
481
const response = await requestAPI < any > (
@@ -489,11 +489,14 @@ export const countObjectNameAppearances = async (
489
489
if (
490
490
fileName . substring ( 0 , originalName . length + 1 ) . includes ( originalName )
491
491
) {
492
- counter + = 1 ;
492
+ dirCount [ fileName ] = 1 ;
493
493
}
494
494
} ) ;
495
495
}
496
-
496
+ const counter = Object . values ( dirCount ) . reduce (
497
+ ( sum , count ) => sum + count ,
498
+ 0
499
+ ) ;
497
500
return counter ;
498
501
} ;
499
502
You can’t perform that action at this time.
0 commit comments