snapshot of https://github.com/marmelab/atomic-crm.git (main, 2026-09-18; blobs > 131072B omitted)
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
This commit is contained in:
22
supabase/functions/users/secondaryEmails.ts
Normal file
22
supabase/functions/users/secondaryEmails.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
const EMAIL_PATTERN = /^[^\s@,]+@[^\s@,]+\.[^\s@,]+$/;
|
||||
|
||||
export const MAX_SECONDARY_EMAILS = 10;
|
||||
|
||||
export const normalizeSecondaryEmails = (
|
||||
secondaryEmails: unknown,
|
||||
): string[] | undefined => {
|
||||
if (!Array.isArray(secondaryEmails)) {
|
||||
return undefined;
|
||||
}
|
||||
return [
|
||||
...new Set(
|
||||
secondaryEmails
|
||||
.filter((email): email is string => typeof email === "string")
|
||||
.map((email) => email.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
export const findInvalidEmail = (emails: string[]): string | undefined =>
|
||||
emails.find((email) => !EMAIL_PATTERN.test(email));
|
||||
Reference in New Issue
Block a user