( fileTree: FileTree, callback: ( content: FileTree | string, filename: string, fullPath: string, ) => void, parent?: string, )
| 90 | }; |
| 91 | |
| 92 | export const traverse = ( |
| 93 | fileTree: FileTree, |
| 94 | callback: ( |
| 95 | content: FileTree | string, |
| 96 | filename: string, |
| 97 | fullPath: string, |
| 98 | ) => void, |
| 99 | parent?: string, |
| 100 | ) => { |
| 101 | for (const [filename, content] of Object.entries(fileTree).sort(([a], [b]) => |
| 102 | a.localeCompare(b), |
| 103 | )) { |
| 104 | const fullPath = parent ? `${parent}/${filename}` : filename; |
| 105 | callback(content, filename, fullPath); |
| 106 | if (typeof content === "object") { |
| 107 | traverse(content, callback, fullPath); |
| 108 | } |
| 109 | } |
| 110 | }; |
no outgoing calls
no test coverage detected