Finalize Typescript restructure

This commit is contained in:
Darko Gjorgjijoski
2026-04-06 17:59:15 +02:00
parent cab785172e
commit 74b4b2df4e
209 changed files with 12419 additions and 1745 deletions

View File

@@ -25,6 +25,26 @@ export function get<T>(key: string): T | null {
}
}
/**
* Retrieve a boolean from localStorage while tolerating legacy string values.
*
* @param key - The localStorage key
* @returns True only when the stored value represents a truthy boolean
*/
export function getBoolean(key: string): boolean {
const value = get<boolean | string>(key)
if (typeof value === 'boolean') {
return value
}
if (typeof value === 'string') {
return value.toLowerCase() === 'true'
}
return false
}
/**
* Store a value in localStorage as JSON.
*