(dir)
| 115 | * @returns {Tree[]} |
| 116 | */ |
| 117 | export default function files(dir) { |
| 118 | const listedDirs = []; |
| 119 | let transform = (item) => item; |
| 120 | if (typeof dir === "string") { |
| 121 | for (const item of Object.values(filesTree)) { |
| 122 | const found = getFile(dir, item); |
| 123 | if (found) return found; |
| 124 | } |
| 125 | return null; |
| 126 | } else if (typeof dir === "function") { |
| 127 | transform = dir; |
| 128 | } |
| 129 | |
| 130 | const allFiles = []; |
| 131 | Object.values(filesTree).forEach((item) => { |
| 132 | allFiles.push(...flattenTree(item, transform, listedDirs)); |
| 133 | }); |
| 134 | return allFiles; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * @typedef {'add-file'|'push-file'|'remove-file'|'add-folder'|'remove-folder'|'refresh'} FileListEvent |
nothing calls this directly
no test coverage detected