8 lines
343 B
TypeScript
8 lines
343 B
TypeScript
import type { AccountConfig } from '../types/account'
|
|
|
|
export function getAccountEmail(account: Pick<AccountConfig, 'email' | 'credentials'>): string {
|
|
const email: string = account.email.trim()
|
|
if (email.includes('@')) return email
|
|
const domain: string = account.credentials.host.replace(/^[^.]+\./, '')
|
|
return `${email}@${domain}`
|
|
}
|