]>
Commit | Line | Data |
---|---|---|
d0800f76 | 1 | import maxBy from 'lodash/maxBy' |
2 | ||
3 | function getBiggestActorImage <T extends { width: number }> (images: T[]) { | |
4 | const image = maxBy(images, 'width') | |
5 | ||
6 | // If width is null, maxBy won't return a value | |
7 | if (!image) return images[0] | |
8 | ||
9 | return image | |
10 | } | |
11 | ||
12 | export { | |
13 | getBiggestActorImage | |
14 | } |