(value: string | undefined)
| 41 | } |
| 42 | |
| 43 | export function parseSampleRate(value: string | undefined): number { |
| 44 | if (value === undefined) { |
| 45 | return DEFAULT_SAMPLE_RATE_HZ; |
| 46 | } |
| 47 | |
| 48 | const rate = Number(value); |
| 49 | |
| 50 | if (!Number.isInteger(rate) || rate < 1 || rate > 100_000) { |
| 51 | throw new Error( |
| 52 | `--sample-rate must be an integer between 1 and 100000; got "${value}"`, |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | return rate; |
| 57 | } |
no outgoing calls
no test coverage detected