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:
parent
1870626af5
commit
a86252b399
2 changed files with 31 additions and 36 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue