( folders: SnippetsLabRecord[], )
| 68 | } |
| 69 | |
| 70 | function buildFolderPathMap( |
| 71 | folders: SnippetsLabRecord[], |
| 72 | ): Map<string, string[]> { |
| 73 | const map = new Map<string, string[]>() |
| 74 | |
| 75 | function visit(folder: SnippetsLabRecord, parentPath: string[]) { |
| 76 | const uuid = readString(folder, 'uuid') |
| 77 | const title = normalizeImportEntryName( |
| 78 | readString(folder, 'title'), |
| 79 | 'Imported', |
| 80 | ) |
| 81 | const folderPath = [...parentPath, title] |
| 82 | |
| 83 | if (uuid) { |
| 84 | map.set(uuid, folderPath) |
| 85 | } |
| 86 | |
| 87 | getRecordArray(folder, 'children').forEach(child => |
| 88 | visit(child, folderPath), |
| 89 | ) |
| 90 | } |
| 91 | |
| 92 | folders.forEach(folder => visit(folder, [])) |
| 93 | |
| 94 | return map |
| 95 | } |
| 96 | |
| 97 | function buildTagMap(tags: SnippetsLabRecord[]): Map<string, string> { |
| 98 | const map = new Map<string, string>() |
no test coverage detected