/**
 * @title: 获取资源map
 * @description:
 * @param {any} resourceList
 * @return {*}
 * @Author: zhiwei.Wang
 */
export var getResourcesMap = function getResourcesMap(resourceList) {
  return resourceList.reduce(function (pre, item) {
    pre[item.id] = item;
    return pre;
  }, {});
};

/**
 * @title: 根据ids筛选资源列表
 * @description:
 * @param {any} resourcesMap
 * @param {any} ids
 * @return {*}
 * @Author: zhiwei.Wang
 * @Date: 2024-09-19 20:23
 */
export var getResourcesByIds = function getResourcesByIds(resourcesMap, ids) {
  return (ids || []).map(function (id) {
    return resourcesMap[id];
  });
};