Keep only string→string entries (token slug → color).
(raw: unknown)
| 7503 | |
| 7504 | /** Keep only string→string entries (token slug → color). */ |
| 7505 | function normalizeThemeTweaks(raw: unknown): Record<string, string> { |
| 7506 | const out: Record<string, string> = {} |
| 7507 | if (raw && typeof raw === 'object' && !Array.isArray(raw)) { |
| 7508 | for (const [key, value] of Object.entries(raw as Record<string, unknown>)) { |
| 7509 | if (typeof value === 'string' && value) out[key] = value |
| 7510 | } |
| 7511 | } |
| 7512 | return out |
| 7513 | } |
| 7514 | |
| 7515 | /** Keep only string→string entries with a `.css` key (tolerant of hand edits). */ |
| 7516 | function normalizeEnabledOverrides(raw: unknown): Record<string, string> { |