"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.clearLocalStorage = exports.deleteLocalStorageItem = exports.getLocalStorageItem = exports.setLocalStorageItem = void 0;

var _tryit = _interopRequireDefault(require("tryit"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const setLocalStorageItem = (item, value) => (0, _tryit.default)(() => localStorage.setItem(item, value));

exports.setLocalStorageItem = setLocalStorageItem;

const getLocalStorageItem = item => {
  let result;
  (0, _tryit.default)(() => {
    result = localStorage.getItem(item);
  });
  return result;
};

exports.getLocalStorageItem = getLocalStorageItem;

const deleteLocalStorageItem = item => (0, _tryit.default)(() => delete localStorage[item]);

exports.deleteLocalStorageItem = deleteLocalStorageItem;

const clearLocalStorage = () => (0, _tryit.default)(() => {
  const debug = localStorage.debug;
  localStorage.clear();

  if (debug) {
    localStorage.debug = debug;
  }
});

exports.clearLocalStorage = clearLocalStorage;