(msg: Api.Message)
| 224 | |
| 225 | function parseIndex(text?: string): number | null { |
| 226 | if (!text || !/^\d+$/.test(text)) return null; |
| 227 | const index = Number.parseInt(text, 10); |
| 228 | return index >= 1 ? index : null; |
| 229 | } |
| 230 | |
| 231 | function clampPage(page: number, totalPages: number): number { |
| 232 | return Math.min(Math.max(page, 1), Math.max(totalPages, 1)); |
| 233 | } |
| 234 |
no test coverage detected