mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-26 10:40:28 -06:00
18 lines
390 B
TypeScript
18 lines
390 B
TypeScript
import { WEBSERVER } from '@server/initializers/constants'
|
|
|
|
function handleToNameAndHost (handle: string) {
|
|
let [ name, host ] = handle.split('@')
|
|
if (host === WEBSERVER.HOST) host = null
|
|
|
|
return { name, host, handle }
|
|
}
|
|
|
|
function handlesToNameAndHost (handles: string[]) {
|
|
return handles.map(h => handleToNameAndHost(h))
|
|
}
|
|
|
|
export {
|
|
handleToNameAndHost,
|
|
handlesToNameAndHost
|
|
}
|