MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / flattenJsdelivrTree

Function flattenJsdelivrTree

website/src/lib/repo-provider.ts:352–363  ·  view source on GitHub ↗
(items: JsdelivrFile[], currentPath = "")

Source from the content-addressed store, hash-verified

350}
351
352function flattenJsdelivrTree(items: JsdelivrFile[], currentPath = ""): string[] {
353 let filePaths: string[] = [];
354 for (const item of items) {
355 const itemPath = currentPath ? `${currentPath}/${item.name}` : item.name;
356 if (item.type === "file") {
357 filePaths.push(itemPath);
358 } else if (item.type === "directory" && item.files) {
359 filePaths.push(...flattenJsdelivrTree(item.files, itemPath));
360 }
361 }
362 return filePaths;
363}
364
365export function getJsdelivrTotalSize(items: JsdelivrFile[]): number {
366 let total = 0;

Callers 1

listRepositoryFilesFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected