(value: unknown)
| 302 | } |
| 303 | |
| 304 | function normalizeWindowState(value: unknown): PersistedWindowState | null { |
| 305 | if (!value || typeof value !== 'object') return null |
| 306 | const candidate = value as Record<string, unknown> |
| 307 | const x = candidate['x'] |
| 308 | const y = candidate['y'] |
| 309 | const width = candidate['width'] |
| 310 | const height = candidate['height'] |
| 311 | if ( |
| 312 | typeof x !== 'number' || |
| 313 | typeof y !== 'number' || |
| 314 | typeof width !== 'number' || |
| 315 | typeof height !== 'number' || |
| 316 | !Number.isFinite(x) || |
| 317 | !Number.isFinite(y) || |
| 318 | !Number.isFinite(width) || |
| 319 | !Number.isFinite(height) |
| 320 | ) { |
| 321 | return null |
| 322 | } |
| 323 | return { |
| 324 | x, |
| 325 | y, |
| 326 | width, |
| 327 | height, |
| 328 | isMaximized: Boolean(candidate['isMaximized']) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | function normalizePersistedConfig(value: unknown): PersistedConfig { |
| 333 | if (!value || typeof value !== 'object') return { ...DEFAULT_CONFIG } |
no outgoing calls
no test coverage detected