(key: keyof DisplaySettings, value: unknown)
| 103 | const DISPLAY_STORAGE_KEY = "cbm-display"; |
| 104 | |
| 105 | function clampSetting(key: keyof DisplaySettings, value: unknown): number { |
| 106 | const { min, max } = DISPLAY_LIMITS[key]; |
| 107 | const n = typeof value === "number" ? value : Number.NaN; |
| 108 | if (!Number.isFinite(n)) return DEFAULT_DISPLAY_SETTINGS[key]; |
| 109 | return Math.min(max, Math.max(min, n)); |
| 110 | } |
| 111 | |
| 112 | export function clampDisplaySettings( |
| 113 | raw: Partial<DisplaySettings>, |
no outgoing calls
no test coverage detected