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:
parent
aaa5acbb0c
commit
11521f231f
31 changed files with 184 additions and 345 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue