'use strict';

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

module.exports = setSessionStorage;
