1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00

fix: sanitize input

This commit is contained in:
2020-02-05 17:28:22 +09:00
parent 01293b6628
commit 7752eb6f5a
3 changed files with 15 additions and 6 deletions

View File

@@ -2,3 +2,7 @@ export function capitalize(text: string): string {
if (text.length === 0) return '';
return text[0].toUpperCase() + text.slice(1).toLowerCase();
}
export function sanitize(text: string): string {
return text.replace(/[\s@+!#$%^&*()[\]./<>{}]/g, '');
}