MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / getTree

Function getTree

src/lib/fileList.js:167–177  ·  view source on GitHub ↗

* Get directory tree * @param {Tree[]} treeList list of tree * @param {string} dir path to find * @returns {Tree}

(treeList, dir)

Source from the content-addressed store, hash-verified

165 * @returns {Tree}
166 */
167function getTree(treeList, dir) {
168 if (!treeList) return;
169 let tree = treeList.find(({ url }) => url === dir);
170 if (tree) return tree;
171 for (const item of treeList) {
172 tree = getTree(item.children, dir);
173 if (tree) return tree;
174 }
175
176 return null;
177}
178
179/**
180 * Get all files in a folder

Callers 6

appendFunction · 0.85
removeFunction · 0.85
renameFunction · 0.85
addNativeEntriesFunction · 0.85
createChildTreeFunction · 0.85
fromJSONMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected