( key: string, env: Environment, )
| 35 | } |
| 36 | |
| 37 | const parseIntegerEnv = ( |
| 38 | key: string, |
| 39 | env: Environment, |
| 40 | ): number | undefined => { |
| 41 | const rawValue = env[key] |
| 42 | if (!rawValue || rawValue.trim() === '') { |
| 43 | return undefined |
| 44 | } |
| 45 | |
| 46 | if (!/^-?\d+$/.test(rawValue.trim())) { |
| 47 | throw new Error(`Invalid ${key}: ${rawValue}. Expected an integer.`) |
| 48 | } |
| 49 | |
| 50 | return Number(rawValue) |
| 51 | } |
| 52 | |
| 53 | export const getXzCompressionOptions = ( |
| 54 | cpuCount: number, |
no outgoing calls
no test coverage detected