Skip to content

Instantly share code, notes, and snippets.

@borlaym
Created October 3, 2019 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borlaym/1757193fbcfb0c74a9619b99e220436f to your computer and use it in GitHub Desktop.
Save borlaym/1757193fbcfb0c74a9619b99e220436f to your computer and use it in GitHub Desktop.
The solution
function getKinjaVideoForPost(post: Post): Array<string> {
const videoNodes = post.body.reduce<Array<KinjaVideoJSON>>((acc, n) => {
if (n.type === 'KinjaVideo') {
return [...acc, n];
}
return acc;
}, []);
return videoNodes.map(vn => vn.id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment