/**
 * If the browser supports localStorage, set the value of the key to the value.
 *
 * @param {string} key - The key to store the value under.
 * @param {string} value - The value to be stored.
 */
export function setItem(key, value) {
  if (window.localStorage) {
    localStorage.setItem(key, JSON.stringify(value));
  }
}
/**
 * If the browser supports localStorage, return the value of the key, otherwise return null.
 *
 * @typedef T generic type
 * @param {string} key - The key of the item you want to get.
 * @returns {T | null} A any type
 */
export function getItem(key) {
  var _a;
  if ((_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(key)) {
    return JSON.parse(window.localStorage.getItem(key));
  }
  return null;
}
