* Creates an in-memory storage implementation that mimics the StorageApi interface * Used as a fallback when localStorage is not available (e.g., server-side rendering) * @returns An object implementing the StorageApi interface using an in-memory Map
()
| 196 | * @returns An object implementing the StorageApi interface using an in-memory Map |
| 197 | */ |
| 198 | function createInMemoryStorage(): StorageApi { |
| 199 | const storage = new Map<string, string>() |
| 200 | |
| 201 | return { |
| 202 | getItem(key: string): string | null { |
| 203 | return storage.get(key) ?? null |
| 204 | }, |
| 205 | setItem(key: string, value: string): void { |
| 206 | storage.set(key, value) |
| 207 | }, |
| 208 | removeItem(key: string): void { |
| 209 | storage.delete(key) |
| 210 | }, |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Creates a no-op storage event API for environments without window (e.g., server-side) |
no outgoing calls
no test coverage detected