1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Support actors with array url field

This commit is contained in:
Chocobozzz 2024-08-20 15:47:38 +02:00
parent 1870626af5
commit a86252b399
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 31 additions and 36 deletions

View file

@ -15,6 +15,16 @@ export function arrayify <T> (element: T | T[]) {
return [ element ]
}
export function unarray <T> (element: T | T[]) {
if (Array.isArray(element)) {
if (element.length === 0) return undefined
return element[0]
}
return element
}
// Avoid conflict with other uniq() functions
export function uniqify <T> (elements: T[]) {
return Array.from(new Set(elements))