Refactor email generation to use alphanumeric suffix instead of numeric-only; extract nanoid alphabet configuration to module-level constant for reusability and change suffix from digits-only to lowercase letters and numbers.

This commit is contained in:
akazwz
2026-03-02 11:56:48 +08:00
parent 5418d41075
commit 55a508249b

View File

@@ -1,6 +1,8 @@
import randomName from "@scaleway/random-name";
import { customAlphabet } from "nanoid";
const nanoSuffix = customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789", 6);
export function generateEmailAddress() {
return `${randomName()}-${customAlphabet("1234567890", 6)()}@smail.pw`;
return `${randomName()}-${nanoSuffix()}@smail.pw`;
}