"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStorageObject = getStorageObject;
const get_storage_1 = require("./get-storage");
const lodash_1 = require("lodash");
function getStorageObject(key, defaultValue) {
    try {
        const dataString = (0, get_storage_1.getStorage)(key, defaultValue);
        const isNilOrEmpty = (0, lodash_1.isNil)(dataString) || (0, lodash_1.isEmpty)(dataString);
        return isNilOrEmpty ? {} : JSON.parse(dataString);
    }
    catch (error) {
        // Only log errors when not in test environment
        if (process.env.NODE_ENV !== 'test') {
            console.error(error);
        }
        return defaultValue;
    }
}
