mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-26 19:10:15 +00:00
13 lines
255 B
JavaScript
13 lines
255 B
JavaScript
![]() |
/**
|
||
|
* Creates a map of ids to entity
|
||
|
* @param {Array} entities = [] list of entities to map to ids
|
||
|
*/
|
||
|
export default (entities = []) =>
|
||
|
entities.reduce(
|
||
|
(idMap, entity) => {
|
||
|
idMap[entity.id] = entity;
|
||
|
return idMap;
|
||
|
},
|
||
|
{}
|
||
|
);
|