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);
}
const store = {
  setItem(key, val) {
    localStorage.setItem(key, serialize(val));
  },
  getItem(key) {
    return deserialize(localStorage.getItem(key));
  },
  removeItem(key) {
    localStorage.removeItem(key);
  },
  clear() {
    localStorage.clear();
  }
};
export default store;