* Parses the configured usernames into a normalized, deduplicated handle list. * * Handles are lowercased and stripped of a leading `@` before deduplication so * that `jack`, `@jack`, and `Jack` collapse to a single entry — avoiding a * duplicate user-id lookup and a redundant `userIndex` slot i
(value: unknown)
| 107 | * cursor's `userIndex` stays aligned to the same array across pages. |
| 108 | */ |
| 109 | function parseUsernames(value: unknown): string[] { |
| 110 | const seen = new Set<string>() |
| 111 | const out: string[] = [] |
| 112 | for (const raw of parseMultiValue(value)) { |
| 113 | const handle = raw.replace(/^@/, '').toLowerCase() |
| 114 | if (!handle || seen.has(handle)) continue |
| 115 | seen.add(handle) |
| 116 | out.push(handle) |
| 117 | } |
| 118 | return out |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Reads and trims a string config field, returning undefined when blank. |
no test coverage detected