This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const setLocalStorage = (key: string, value: any) => { | |
if (typeof key !== "string") { | |
throw new Error(`Error in localStorage: key ${key} must be of type string but is ${typeof key}`); | |
} | |
const typeOfValue = typeof value; | |
console.log(`localStorage: about to save value of type ${typeOfValue} for key ${key}`); | |
let valueToStore; | |
switch (typeOfValue) { | |
case "string": |