* Get directory tree * @param {Tree[]} treeList list of tree * @param {string} dir path to find * @returns {Tree}
(treeList, dir)
| 165 | * @returns {Tree} |
| 166 | */ |
| 167 | function 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 |
no outgoing calls
no test coverage detected