function set(key, value) {
  return uni.setStorageSync(key, JSON.stringify(value))
}

function get(key) {
  try {
    const result = uni.getStorageSync(key)
    if (result) {
      return JSON.parse(result)
    }
  } catch (e) {
    return null
  }
}

function remove(key) {
  return uni.removeStorageSync(key)
}

function clear(key) {
  return uni.clearStorageSync(key)
}

export default {
  get,
  set,
  remove,
  clear
}
