14 lines
299 B
TypeScript
14 lines
299 B
TypeScript
import type { MediaItem } from '@/types/media';
|
|
|
|
export function getFirstCoverImage(
|
|
items: Array<{ images?: MediaItem[] }>,
|
|
): MediaItem | undefined {
|
|
for (const item of items) {
|
|
if (item.images?.length) {
|
|
return item.images[0];
|
|
}
|
|
}
|
|
|
|
return undefined;
|
|
}
|