11 lines
432 B
JavaScript
11 lines
432 B
JavaScript
export function selectBoardByUserProjects(boardsByID, projectsByName) {
|
|
const userProjects = Object.keys(projectsByName);
|
|
return Object.keys(boardsByID).reduce((filteredBoardsByID, boardID) => {
|
|
const board = boardsByID[boardID];
|
|
const hasProject = board.projects.some(p => userProjects.indexOf(p) !== -1);
|
|
if (hasProject) {
|
|
filteredBoardsByID[boardID] = board;
|
|
}
|
|
return filteredBoardsByID;
|
|
}, {});
|
|
} |