Add videoBenchmarksRelatedToApp helper

This commit is contained in:
Sam Carlton 2022-06-09 15:55:44 -05:00
parent d9610b18f8
commit 6c3c4c1ca7

View file

@ -1,6 +1,8 @@
// import { allVideoAppsListSet } from '~/helpers/get-list.js'
// import videoList from '~/static/video-list.json'
import { getAppEndpoint, getAppType } from '~/helpers/app-derived.js'
function videoHasAppEndpoint ( video, appEndpoint ) {
for (const appLink of video.appLinks) {
if ( appLink.endpoint === appEndpoint ) {
@ -70,3 +72,13 @@ export function videosRelatedToApp ( app, videoListSet ) {
return relatedVideos
}
export function videoBenchmarksRelatedToApp ( app, videoListSet ) {
return videosRelatedToApp( app, videoListSet ).map(video => {
return {
...video,
endpoint: `${getAppEndpoint( app )}/benchmarks#${video.id}`
}
})
}