import JSONFunctions from "../../Types/JSONFunctions";
import Typeof from "../../Types/Typeof";
export default class LocalStorage {
    static setItem(key, value) {
        if (typeof value === Typeof.Object) {
            // if of type jsonobject.
            value = JSON.stringify(JSONFunctions.serializeValue(value));
        }
        localStorage.setItem(key, value);
    }
    static getItem(key) {
        const value = localStorage.getItem(key);
        try {
            if (value) {
                return JSONFunctions.deserializeValue(JSONFunctions.parse(value === null || value === void 0 ? void 0 : value.toString()));
            }
            return value;
        }
        catch (_a) {
            return value;
        }
    }
    static removeItem(key) {
        return localStorage.removeItem(key);
    }
    static clear() {
        localStorage.clear();
    }
    static getAllItems() {
        return Object.assign({}, localStorage);
    }
}
//# sourceMappingURL=LocalStorage.js.map