Last active
December 7, 2020 15:57
-
-
Save nagyadam2092/69edb762d427e54d0dc41110f68854a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const movieLists = [ | |
// ... | |
]; | |
const boxartSizeRestrictions = boxart => | |
boxart.width === 150 && boxart.height === 200; | |
const videoBoxartMapper = (boxart, video) => ({ | |
id: video.id, | |
title: video.title, | |
boxart: boxart.url | |
}); | |
const videosIterator = video => | |
video.boxarts | |
.filter(boxartSizeRestrictions) | |
.map(boxart => videoBoxartMapper(boxart, video)); | |
const movieListIterator = movieList => movieList.videos.flatMap(videosIterator); | |
const result = movieLists.flatMap(movieListIterator); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment