Parse a raw string value into the appropriate type.
(raw: string)
| 48 | |
| 49 | /** Parse a raw string value into the appropriate type. */ |
| 50 | function parseValue(raw: string): unknown { |
| 51 | if (raw === "true") return true; |
| 52 | if (raw === "false") return false; |
| 53 | const num = Number(raw); |
| 54 | if (!Number.isNaN(num) && raw.trim() !== "") return num; |
| 55 | return raw; |
| 56 | } |
| 57 | |
| 58 | /** Check that the parsed value matches the runtime type of the existing config field. */ |
| 59 | function isTypeCompatible(existing: unknown, parsed: unknown): boolean { |
no outgoing calls
no test coverage detected