{"size": 650, "ext": "js", "max_stars_repo_path": "front-end(web)/src/utils/localStorage.js", "max_stars_repo_name": "BarefootBKK/Book-Storm", "max_stars_repo_stars_event_min_datetime": "2019-07-13T16:42:42.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T08:58:46.000Z", "max_issues_repo_path": "front-end(web)/src/utils/localStorage.js", "max_issues_repo_name": "wedtlcy/Book-Storm", "max_issues_repo_issues_event_min_datetime": "2020-04-17T04:40:45.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-17T04:40:45.000Z", "max_forks_repo_path": "front-end(web)/src/utils/localStorage.js", "max_forks_repo_name": "wedtlcy/Book-Storm", "max_forks_repo_forks_event_min_datetime": "2019-11-14T06:04:22.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-29T13:08:15.000Z"}
{"max_stars_count": 19, "max_issues_count": 1, "max_forks_count": 8, "avg_line_length": 20.3125, "max_line_length": 51, "alphanum_fraction": 0.5338461538}
export const setStore = (key, value) => {
  if (!key) return
  if (typeof value !== 'string') {
    value = JSON.stringify(value)
  }

  window.localStorage.setItem(key, value)
}

export const getStore = (key) => {
  if (!key) return
  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  // 别忘了转成 json，保存的是 string
  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  let data = window.localStorage.getItem(key)
  try {
    data = JSON.parse(data)
  } catch (e) {

  }
  return data
}

export const removeStore = (key) => {
  if (!key) return
  window.localStorage.removeItem(key)
}

export const clearStore = () => {
  window.localStorage.clear()
}
