[READ-ONLY] a fast, modern browser for the npm registry

perf: hoist skill file counting function

+3 -5
+3 -5
server/utils/skills.ts
··· 88 88 .map(child => ({ name: child.name, children: child.children || [] })) 89 89 } 90 90 91 + const countFilesRecursive = (nodes: PackageFileTree[]): number => 92 + nodes.reduce((acc, n) => acc + (n.type === 'file' ? 1 : countFilesRecursive(n.children || [])), 0) 93 + 91 94 /** 92 95 * Count files in skill subdirectories (scripts, references, assets). 93 96 */ 94 97 export function countSkillFiles(children: PackageFileTree[]): SkillFileCounts | undefined { 95 98 const counts: SkillFileCounts = {} 96 - const countFilesRecursive = (nodes: PackageFileTree[]): number => 97 - nodes.reduce( 98 - (acc, n) => acc + (n.type === 'file' ? 1 : countFilesRecursive(n.children || [])), 99 - 0, 100 - ) 101 99 102 100 for (const child of children) { 103 101 if (child.type !== 'directory') continue