Function
parsePositiveInt
(value: string | undefined, fallback: number)
Source from the content-addressed store, hash-verified
| 35 | } |
| 36 | |
| 37 | function parsePositiveInt(value: string | undefined, fallback: number): number { |
| 38 | if (!value) { |
| 39 | return fallback; |
| 40 | } |
| 41 | const parsed = Number.parseInt(value, 10); |
| 42 | if (!Number.isFinite(parsed) || parsed <= 0) { |
| 43 | return fallback; |
| 44 | } |
| 45 | return parsed; |
| 46 | } |
| 47 | |
| 48 | function parseBoolean(value: string | undefined): boolean { |
| 49 | if (!value) { |
Tested by
no test coverage detected