1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00
Peertube/server/core/lib/actor-image.ts
2023-10-04 15:13:25 +02:00

14 lines
290 B
TypeScript

import maxBy from 'lodash-es/maxBy.js'
function getBiggestActorImage <T extends { width: number }> (images: T[]) {
const image = maxBy(images, 'width')
// If width is null, maxBy won't return a value
if (!image) return images[0]
return image
}
export {
getBiggestActorImage
}