MCPcopy Create free account
hub / github.com/massCodeIO/massCode / resolve

Function resolve

src/shared/notes/folderPath.ts:16–40  ·  view source on GitHub ↗
(folderId: number)

Source from the content-addressed store, hash-verified

14 const visiting = new Set<number>()
15
16 const resolve = (folderId: number): string => {
17 const cached = resolved.get(folderId)
18 if (cached !== undefined) {
19 return cached
20 }
21
22 const folder = folderById.get(folderId)
23 if (!folder) {
24 return ''
25 }
26
27 if (visiting.has(folderId)) {
28 return folder.name
29 }
30
31 visiting.add(folderId)
32 const parentPath = folder.parentId !== null ? resolve(folder.parentId) : ''
33 const currentPath = parentPath
34 ? `${parentPath}/${folder.name}`
35 : folder.name
36
37 resolved.set(folderId, currentPath)
38 visiting.delete(folderId)
39 return currentPath
40 }
41
42 folders.forEach(folder => resolve(folder.id))
43 return resolved

Callers 8

buildNoteFolderPathMapFunction · 0.70
flushTitleResolutionsFunction · 0.50
onConfirmFunction · 0.50
onCancelFunction · 0.50
vite.config.tsFile · 0.50
writeBundleFunction · 0.50
package.mjsFile · 0.50

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected