feat: add volunteer shift signup app
Initial source, tests, migrations, and local Docker setup for the Hope Food Pantry volunteer scheduler.
This commit is contained in:
commit
f1a46e2ba7
129 files changed
+25290
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export class EmailAddressError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'EmailAddressError';
|
||||
}
|
||||
}
|
||||
|
||||
/** Trim, Unicode normalize, and lowercase. Dots and plus-tags are kept. */
|
||||
export function normalizeEmail(input: string): string {
|
||||
const normalized = input.normalize('NFC').trim().toLowerCase();
|
||||
if (
|
||||
normalized.length === 0 ||
|
||||
/\s/.test(normalized) ||
|
||||
!normalized.includes('@') ||
|
||||
normalized.startsWith('@') ||
|
||||
normalized.endsWith('@')
|
||||
) {
|
||||
throw new EmailAddressError('Enter an email address.');
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
Reference in new issue
Block a user