import { BUTILS_CACHE } from './consts';

/**
 * 获取缓存数据
 * @param {string} key
 * @returns
 *
 * @example
 * getCache('USER_INFO');
 */
function getCache(key) {
  var caches = window[BUTILS_CACHE] || {};

  if (caches.hasOwnProperty(key)) {
    return caches[key];
  }

  return null;
}

export default getCache;
