Someone that has a clean solution for this? I have this data structure:
posts: Post[]interface Post { stream : { id: string name: string } isCompleted: boolean // other data...}
posts: Post[]interface Post { stream : { id: string name: string } isCompleted: boolean // other data...}
I want to get a response with two data structures (maps) mapped by stream name that separates completed streams and uncompleted streams where the keys are the stream names. A stream is considered completed if all the posts in that stream are completed. I guess a reduce would be the way to go but would need help with some specifics.
completedStreams: { // keys are the names of the completed streams and inside is an array with // the posts}uncompletedStreams: { // keys are the names of the unCompleted streams and inside is an array with // the posts for these streams}
completedStreams: { // keys are the names of the completed streams and inside is an array with // the posts}uncompletedStreams: { // keys are the names of the unCompleted streams and inside is an array with // the posts for these streams}