MCPcopy Create free account
hub / github.com/NiladriHazra/WhatToBuild / extractFiles

Function extractFiles

components/RepositoryKeyFiles.tsx:111–124  ·  view source on GitHub ↗
(nodes: any[], result: any[] = [])

Source from the content-addressed store, hash-verified

109 // Extract all files from the hierarchical file tree
110
111 const extractFiles = (nodes: any[], result: any[] = []) => {
112 for (const node of nodes) {
113 if (node.type === 'file' || node.type === 'blob') {
114 result.push({
115 path: node.path,
116 type: 'blob',
117 size: node.size || 0
118 });
119 } else if ((node.type === 'directory' || node.type === 'tree') && node.children) {
120 extractFiles(node.children, result);
121 }
122 }
123 return result;
124 };
125 files = extractFiles(structureData.fileTree);
126 } else if (structureData.tree && Array.isArray(structureData.tree)) {
127 files = structureData.tree.filter((item: any) => item.type === 'blob' || item.type === 'file');

Callers 1

fetchKeyFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected