(value: Primitive)
| 16 | let cachedVerbose: boolean | undefined; |
| 17 | |
| 18 | function coerceBoolean(value: Primitive): boolean | undefined { |
| 19 | if (value === undefined || value === null) return undefined; |
| 20 | if (typeof value === 'boolean') return value; |
| 21 | if (typeof value === 'number') return value !== 0; |
| 22 | if (typeof value === 'string') { |
| 23 | const normalized = value.trim().toLowerCase(); |
| 24 | if (!normalized) return undefined; |
| 25 | if (['1', 'true', 'yes', 'y', 'on', 'debug'].includes(normalized)) { |
| 26 | return true; |
| 27 | } |
| 28 | if (['0', 'false', 'no', 'n', 'off'].includes(normalized)) { |
| 29 | return false; |
| 30 | } |
| 31 | return true; |
| 32 | } |
| 33 | return undefined; |
| 34 | } |
| 35 | |
| 36 | export function resolveVerboseFlag(options: ResolveOptions = {}): boolean { |
| 37 | if (options.cache !== false && typeof cachedVerbose === 'boolean') { |
no test coverage detected