Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1759,17 +1759,20 @@ <h4>Exercise 14: Use concatMap() to retrieve id, title, and 150x200 box art url
// {"id": 70111470,"title": "Die Hard","boxart":"http://cdn-0.nflximg.com/images/2891/DieHard150.jpg" }
// ];

return movieLists.concatMap(function(movieList) {
return movieList.videos.concatMap(function(video) {
return video.boxarts.
filter(function(boxart) {
return boxart.width === 150;
}).
map(function(boxart) {
return {id: video.id, title: video.title, boxart: boxart.url};
});
});
});
return movieLists.concatMap(movieList =>
movieList.videos.concatMap(video =>
video.boxarts.
filter(boxart => boxart.width === 150).
map(boxart =>
({
'id': video.id,
'title': video.title,
'boxart': boxart.url
})
)
)
);

}
</pre>
<p class="post">It's a very common pattern to see several nested concatMap operations, with the last operation being a
Expand Down