aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/actor-image.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/actor-image.ts')
-rw-r--r--server/lib/actor-image.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/lib/actor-image.ts b/server/lib/actor-image.ts
new file mode 100644
index 000000000..e9bd148f6
--- /dev/null
+++ b/server/lib/actor-image.ts
@@ -0,0 +1,14 @@
1import maxBy from 'lodash/maxBy'
2
3function 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
12export {
13 getBiggestActorImage
14}