"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createLocalStorage = void 0;
function createLocalStorage(_a) {
    var namespace = _a.namespace;
    var storageKeyPrefix = "".concat(namespace, ":");
    var getStorageKey = function (key) { return "".concat(storageKeyPrefix).concat(key); };
    var storage = {
        setItem: function (key, value) { return localStorage.setItem(getStorageKey(key), value); },
        getItem: function (key) { return localStorage.getItem(getStorageKey(key)); },
        removeItem: function (key) { return localStorage.removeItem(getStorageKey(key)); },
        get length() {
            var keys = 0;
            for (var key in localStorage) {
                if (key.indexOf(storageKeyPrefix) === 0) {
                    keys += 1;
                }
            }
            return keys;
        },
        clear: function () {
            for (var key in localStorage) {
                if (key.indexOf(storageKeyPrefix) === 0) {
                    localStorage.removeItem(key);
                }
            }
        },
    };
    return storage;
}
exports.createLocalStorage = createLocalStorage;
//# sourceMappingURL=custom.js.map