(key: string, id: string, data: T)
| 102 | try { const c = localStorage.getItem(key); return c ? JSON.parse(c) : {}; } catch { return {}; } |
| 103 | } |
| 104 | function setCache<T>(key: string, id: string, data: T) { |
| 105 | const cache = getCache<T>(key); |
| 106 | (cache as any)[id] = { data, timestamp: Date.now() }; |
| 107 | localStorage.setItem(key, JSON.stringify(cache)); |
| 108 | } |
| 109 | |
| 110 | function ndviColor(val: number): string { |
| 111 | if (val > 0.6) return "hsl(var(--field-green, 140 40% 40%))"; |
no test coverage detected