aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/lib/actor-image.ts
blob: e9bd148f6e321e4ad22a2e8d765e08f9afb0773a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                           
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
}