Rocket.Chat/apps/meteor/lib/getUserEmailAddress.ts
Jean Brito cd32f0918b
Chore: Convert to TS omnichannel/agent (#25511)
Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>
2022-05-31 22:55:02 -03:00

5 lines
242 B
TypeScript

import type { IUser } from '@rocket.chat/core-typings';
export const getUserEmailAddress = (user: Pick<IUser, 'emails'>): string | undefined =>
Array.isArray(user.emails) ? user.emails.find(({ address }) => !!address)?.address : undefined;