mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
10 lines
369 B
TypeScript
10 lines
369 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
export function extractEmailDomain(email: string | null | undefined): string | null {
|
|
const normalized = email?.trim().toLowerCase();
|
|
if (!normalized) return null;
|
|
const atIndex = normalized.lastIndexOf('@');
|
|
if (atIndex <= 0 || atIndex === normalized.length - 1) return null;
|
|
return normalized.slice(atIndex + 1);
|
|
}
|