| 496 | |
| 497 | const trueBooleanValues = ["true", "yes", "1"] |
| 498 | function booleanRawValue(rawValue: any) { |
| 499 | if (typeof rawValue === "string") { |
| 500 | if (trueBooleanValues.includes(rawValue.toLowerCase())) { |
| 501 | return true |
| 502 | } |
| 503 | return false |
| 504 | } |
| 505 | |
| 506 | if (typeof rawValue === "number") { |
| 507 | return rawValue !== 0 |
| 508 | } |
| 509 | |
| 510 | if (typeof rawValue === "boolean") { |
| 511 | return rawValue |
| 512 | } |
| 513 | |
| 514 | return false |
| 515 | } |
| 516 | |
| 517 | function EditOptionNumberField({ option }: { option: SettingsOption }) { |
| 518 | const inputRef = useRef<HTMLInputElement | null>(null) |