* Checks if a query matches any of the command's aliases. * Returns the matched alias if found, otherwise undefined.
( query: string, aliases?: string[], )
| 248 | * Returns the matched alias if found, otherwise undefined. |
| 249 | */ |
| 250 | function findMatchedAlias( |
| 251 | query: string, |
| 252 | aliases?: string[], |
| 253 | ): string | undefined { |
| 254 | if (!aliases || aliases.length === 0 || query === '') { |
| 255 | return undefined |
| 256 | } |
| 257 | // Check if query is a prefix of any alias (case-insensitive) |
| 258 | return aliases.find(alias => alias.toLowerCase().startsWith(query)) |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Creates a suggestion item from a command. |
no outgoing calls
no test coverage detected