mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-12-01 21:09:17 -06:00
15 lines
284 B
TypeScript
15 lines
284 B
TypeScript
|
import maxBy from 'lodash/maxBy'
|
||
|
|
||
|
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
|
||
|
}
|