1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Generate small versions of banners too

This commit is contained in:
Chocobozzz 2024-03-27 14:00:40 +01:00
parent aaa5acbb0c
commit 11521f231f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
31 changed files with 184 additions and 345 deletions

View file

@ -43,3 +43,23 @@ export function sortBy (obj: any[], key1: string, key2?: string) {
return 1
})
}
export function maxBy <T> (arr: T[], property: keyof T) {
let result: T
for (const obj of arr) {
if (!result || result[property] < obj[property]) result = obj
}
return result
}
export function minBy <T> (arr: T[], property: keyof T) {
let result: T
for (const obj of arr) {
if (!result || result[property] > obj[property]) result = obj
}
return result
}