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 (
475475 path : string ,
476476 originalName : string
477477) : Promise < number > => {
478- let counter : number = 0 ;
478+ let dirCount : { [ fileName : string ] : number } = { } ;
479479 path = path . substring ( 0 , path . lastIndexOf ( '/' ) ) ;
480480
481481 const response = await requestAPI < any > (
@@ -489,11 +489,14 @@ export const countObjectNameAppearances = async (
489489 if (
490490 fileName . substring ( 0 , originalName . length + 1 ) . includes ( originalName )
491491 ) {
492- counter + = 1 ;
492+ dirCount [ fileName ] = 1 ;
493493 }
494494 } ) ;
495495 }
496-
496+ const counter = Object . values ( dirCount ) . reduce (
497+ ( sum , count ) => sum + count ,
498+ 0
499+ ) ;
497500 return counter ;
498501} ;
499502
You can’t perform that action at this time.
0 commit comments