Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Exercise 13 answer to ES6 format #120

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
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