The names one relation points at, deduplicated, in the graph's order.
(
edges: readonly InsightEdge[],
type: string,
byId: ReadonlyMap<number, InsightNode>,
)
| 312 | |
| 313 | /** The names one relation points at, deduplicated, in the graph's order. */ |
| 314 | function named( |
| 315 | edges: readonly InsightEdge[], |
| 316 | type: string, |
| 317 | byId: ReadonlyMap<number, InsightNode>, |
| 318 | ): string[] { |
| 319 | const out: string[] = []; |
| 320 | for (const edge of edges) { |
| 321 | if (edge.type !== type) { |
| 322 | continue; |
| 323 | } |
| 324 | const name = byId.get(edge.target)?.name; |
| 325 | if (name !== undefined && name.length > 0 && !out.includes(name)) { |
| 326 | out.push(name); |
| 327 | } |
| 328 | } |
| 329 | return out; |
| 330 | } |
| 331 | |
| 332 | /** One sentence over up to {@link STEP_INSIGHT_CAP} names, and a count for the rest. */ |
| 333 | function listed(names: readonly string[], phrase: (name: string) => string): string { |