Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return addresses.map((address: NodemailerAddress) => {
return {
Email: EmailString.decode(address.address).getOrElseL(() => {
// this never happens as nodemailer has already parsed
// the email address (so it's a valid one)
throw new Error(
`Error while parsing email address (toMailupAddresses): invalid format '${
address.address
}'.`
);
}),
Name: address.name || address.address
};
});
}
return async request => {
const errorOrUserEmail = EmailString.decode(
request.header(HEADER_USER_EMAIL)
);
if (isLeft(errorOrUserEmail)) {
return left, IAzureUserAttributes>(
ResponseErrorInternal(
`Missing, empty or invalid ${HEADER_USER_EMAIL} header`
)
);
}
const userEmail = errorOrUserEmail.value;
const errorOrUserSubscriptionId = NonEmptyString.decode(
request.header(HEADER_USER_SUBSCRIPTION_KEY)
);