traxxx/assets/js/curate.js

31 lines
672 B
JavaScript
Raw Normal View History

function curateActor(actor) {
const curatedActor = {
...actor,
avatar: actor.avatar[0],
origin: actor.originCountry && {
country: actor.originCountry,
},
};
return curatedActor;
}
function curateRelease(release) {
const curatedRelease = {
...release,
actors: release.actors.map(({ actor }) => curateActor(actor)),
poster: release.poster[0],
network: release.site.network,
tags: release.tags.map(({ tag }) => tag),
};
if (release.trailer) [curatedRelease.trailer] = release.trailer;
return curatedRelease;
}
export {
curateActor,
curateRelease,
};