1
0
Fork 0
peertube/server/helpers/actors.ts
2021-12-07 09:46:01 +01:00

17 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
}