MCPcopy Index your code
hub / github.com/massCodeIO/massCode / buildFolderPathMap

Function buildFolderPathMap

src/main/import/snippets/snippetsLab.ts:70–95  ·  view source on GitHub ↗
(
  folders: SnippetsLabRecord[],
)

Source from the content-addressed store, hash-verified

68}
69
70function 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
97function buildTagMap(tags: SnippetsLabRecord[]): Map<string, string> {
98 const map = new Map<string, string>()

Callers 1

parseSnippetsLabFilesFunction · 0.70

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected