Merge dev into added_docs

This commit is contained in:
Konsti Wohlwend 2025-07-06 04:32:10 -07:00 committed by GitHub
commit 0ad80c4a22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -373,7 +373,6 @@ export function normalizeEmail(email: string): string {
throw new TypeError('normalize-email expects a string');
}
const removeDotsDomains = ['gmail.com', 'googlemail.com', 'live.com'];
const emailLower = email.trim().toLowerCase();
const emailParts = emailLower.split(/@/);
@ -384,16 +383,12 @@ export function normalizeEmail(email: string): string {
let [username, domain] = emailParts;
if (removeDotsDomains.includes(domain)) {
username = username.replace(/\.+/g, '');
}
return `${username}@${domain}`;
}
import.meta.vitest?.test('normalizeEmail(...)', async ({ expect }) => {
expect(normalizeEmail('Example.Test@gmail.com')).toBe('exampletest@gmail.com');
expect(normalizeEmail('Example.Test+123@gmail.com')).toBe('exampletest+123@gmail.com');
expect(normalizeEmail('Example.Test@gmail.com')).toBe('example.test@gmail.com');
expect(normalizeEmail('Example.Test+123@gmail.com')).toBe('example.test+123@gmail.com');
expect(normalizeEmail('exampletest@gmail.com')).toBe('exampletest@gmail.com');
expect(normalizeEmail('EXAMPLETEST@gmail.com')).toBe('exampletest@gmail.com');