(value: unknown, sourceLabel: string, rawKey: string)
| 97 | } |
| 98 | |
| 99 | function parseBooleanValue(value: unknown, sourceLabel: string, rawKey: string): boolean { |
| 100 | if (typeof value === 'boolean') return value; |
| 101 | if (typeof value === 'string') { |
| 102 | const parsed = parseBooleanLiteral(value); |
| 103 | if (parsed !== undefined) return parsed; |
| 104 | } |
| 105 | throw new AppError( |
| 106 | 'INVALID_ARGS', |
| 107 | `Invalid value for "${rawKey}" in ${sourceLabel}. Expected boolean.`, |
| 108 | ); |
| 109 | } |
| 110 | |
| 111 | export function parseBooleanLiteral(value: string): boolean | undefined { |
| 112 | const normalized = value.trim().toLowerCase(); |
no test coverage detected