()
| 11 | } |
| 12 | |
| 13 | export function coerceBooleanFromText(): z.ZodType<boolean> { |
| 14 | return z.preprocess((value) => { |
| 15 | if (typeof value === 'string') { |
| 16 | const normalized = value.trim().toLowerCase(); |
| 17 | if (normalized === 'true') { |
| 18 | return true; |
| 19 | } |
| 20 | if (normalized === 'false') { |
| 21 | return false; |
| 22 | } |
| 23 | } |
| 24 | return value; |
| 25 | }, z.boolean()); |
| 26 | } |
no outgoing calls
no test coverage detected