(index: number, optionsLength: number)
| 23 | } |
| 24 | |
| 25 | function clampIndex(index: number, optionsLength: number): number { |
| 26 | if (optionsLength <= 0) return 0; |
| 27 | return Math.max(0, Math.min(index, optionsLength - 1)); |
| 28 | } |
| 29 | |
| 30 | function createNonInteractivePrompter(): Prompter { |
| 31 | return { |