"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteAllSessionStorage = exports.deleteAllLocalStorage = exports.deleteAllStorage = exports.getAllSessionStorage = exports.getAllLocalStorage = exports.getAllStorage = exports.getStorageKeys = exports.storageHasKey = void 0;
const f_1 = require("../../../system/f/object/Keys/f");
function storageHasKey(storage, key) {
    const item = storage.getItem(key);
    const has = !!item;
    return has;
}
exports.storageHasKey = storageHasKey;
function getStorageKeys(storage) {
    return (0, f_1.keys)(storage);
}
exports.getStorageKeys = getStorageKeys;
function getAllStorage(storage) {
    const obj = {};
    const keys = getStorageKeys(storage);
    for (const key of keys) {
        obj[key] = storage.getItem(key);
    }
    return obj;
}
exports.getAllStorage = getAllStorage;
function getAllLocalStorage() {
    return getAllStorage(localStorage);
}
exports.getAllLocalStorage = getAllLocalStorage;
function getAllSessionStorage() {
    return getAllStorage(sessionStorage);
}
exports.getAllSessionStorage = getAllSessionStorage;
function deleteAllStorage(storage) {
    storage.clear();
}
exports.deleteAllStorage = deleteAllStorage;
function deleteAllLocalStorage() {
    deleteAllStorage(localStorage);
}
exports.deleteAllLocalStorage = deleteAllLocalStorage;
function deleteAllSessionStorage() {
    deleteAllStorage(sessionStorage);
}
exports.deleteAllSessionStorage = deleteAllSessionStorage;
//# sourceMappingURL=storage.js.map