(input: string)
| 24 | * parseCommand('logout') // => '' (not a slash command) |
| 25 | */ |
| 26 | export function parseCommand(input: string): string { |
| 27 | const trimmed = input.trim() |
| 28 | if (!trimmed.startsWith('/')) { |
| 29 | return '' |
| 30 | } |
| 31 | const normalized = trimmed.slice(1) |
| 32 | const firstWord = normalized.split(/\s+/)[0] || '' |
| 33 | return firstWord.toLowerCase() |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Result of parsing a command-like input. |
no outgoing calls
no test coverage detected