31 lines
672 B
JavaScript
31 lines
672 B
JavaScript
|
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,
|
||
|
};
|