import { IUserOrgRelationship , IUserWithOrgType } from "../types" ; private export param { IUserWithOrgType [ ] } users return { IUserOrgRelationship } export function groupUsersByOrgRelationship ( users ) { return users . reduce ( ( acc , user ) => { const orgType = user . orgType as keyof IUserOrgRelationship ; acc [ orgType ] . push ( user ) ; return acc ; } , { world : [ ] , org : [ ] , community : [ ] , partnered : [ ] , collaborationCoordinator : [ ] , } ) ; }