( storageKey: string, defaultValue = false, )
| 50 | }; |
| 51 | |
| 52 | export function readStoredFlag( |
| 53 | storageKey: string, |
| 54 | defaultValue = false, |
| 55 | ): boolean { |
| 56 | if (typeof window === "undefined") { |
| 57 | return defaultValue; |
| 58 | } |
| 59 | |
| 60 | const value = window.localStorage.getItem(storageKey); |
| 61 | return value == null ? defaultValue : value === "1"; |
| 62 | } |
| 63 | |
| 64 | export function writeStoredFlag(storageKey: string, value: boolean): void { |
| 65 | if (typeof window === "undefined") { |
no outgoing calls
no test coverage detected