import _typeof from "@babel/runtime/helpers/esm/typeof";
function deserialize(val) {
  try {
    return _typeof(val) === 'object' ? JSON.parse(val) : val;
  } catch (_unused) {
    // console.log(error);
    return val || undefined;
  }
}
function serialize(val) {
  return JSON.stringify(val);
}
var store = {
  setItem: function setItem(key, val) {
    localStorage.setItem(key, serialize(val));
  },
  getItem: function getItem(key) {
    return deserialize(localStorage.getItem(key));
  },
  removeItem: function removeItem(key) {
    localStorage.removeItem(key);
  },
  clear: function clear() {
    localStorage.clear();
  }
};
export default store;