(refSlug: string, referencedBy: string)
| 68 | const danglingMap = new Map<string, string[]>(); |
| 69 | |
| 70 | function recordDangling(refSlug: string, referencedBy: string): void { |
| 71 | const list = danglingMap.get(refSlug); |
| 72 | if (list) { |
| 73 | // Don't double-count if the same body refs the same dangling slug |
| 74 | // twice — duplicate `[[foo]] [[foo]]` should still surface a single |
| 75 | // referrer in the UI. |
| 76 | if (!list.includes(referencedBy)) list.push(referencedBy); |
| 77 | } else { |
| 78 | danglingMap.set(refSlug, [referencedBy]); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | function buildNode(entry: EngramEntry): MemoryTreeNode { |
| 83 | visited.add(entry.slug); |
no test coverage detected