/**
 * 设置LocalStorage数据
 * @param {string} key
 * @param {any} value
 *
 * setLocalStorage('num', 123);
 * setLocalStorage('str', '123');
 * setLocalStorage('arr', []);
 * setLocalStorage('obj', {});
 * console.log(getLocalStorage('num'))  // => 123
 * console.log(getLocalStorage('str'))  // => '123'
 * console.log(getLocalStorage('arr'))  // => []
 * console.log(getLocalStorage('obj'))  // => {}
 */
function setLocalStorage(key, value) {
  try {
    localStorage.setItem(key, JSON.stringify(value));
  } catch (_unused) {}
}

export default setLocalStorage;
