MCPcopy Create free account
hub / github.com/Alfredredbird/CyberKelp / buildFolderTree

Function buildFolderTree

notesManifest.js:313–330  ·  view source on GitHub ↗
(notes)

Source from the content-addressed store, hash-verified

311
312// Folder tree builder (unchanged)
313function buildFolderTree(notes) {
314 const root = {};
315
316 for (const note of notes) {
317 const parts = note.folder ? note.folder.split("/") : [];
318 let node = root;
319
320 for (const part of parts) {
321 if (!node[part]) node[part] = { __children: {} };
322 node = node[part].__children;
323 }
324
325 if (!node.__files) node.__files = [];
326 node.__files.push(note);
327 }
328
329 return root;
330}
331
332const FOLDER_TREE = buildFolderTree(NOTES);

Callers 1

notesManifest.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected