aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/actors.ts
blob: c31fe6f8e27fe41ddd38bcb067acff79d2a88ab9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
}