(value: string, key: string, min: number, max?: number)
| 413 | } |
| 414 | |
| 415 | function parseIntConfigValue(value: string, key: string, min: number, max?: number): number { |
| 416 | const parsed = parseInt(value, 10); |
| 417 | if (!Number.isFinite(parsed) || parsed < min || (max !== undefined && parsed > max)) { |
| 418 | console.error( |
| 419 | max === undefined |
| 420 | ? `${key} must be >= ${min}` |
| 421 | : `${key} must be between ${min} and ${max}` |
| 422 | ); |
| 423 | process.exit(1); |
| 424 | } |
| 425 | return parsed; |
| 426 | } |
| 427 | |
| 428 | function parseNumberConfigValue(value: string, key: string, min: number, max: number): number { |
| 429 | const parsed = Number(value); |
no outgoing calls
no test coverage detected