/** * Account Register Configuration * 账号注册工具配置 */ /** * 默认配置 */ const DEFAULT_CONFIG = { // 邮箱配置 email: { domain: 'gmail.com', pattern: null }, // 用户名配置 username: { type: 'word', // word, random, numeric minLength: 8, maxLength: 12, pattern: null }, // 密码配置 password: { strategy: 'email', // 'email' = 使用邮箱作为密码, 'random' = 随机密码 length: 12, includeUppercase: true, includeLowercase: true, includeNumbers: true, includeSpecial: true }, // 手机号配置 phone: { country: 'CN', withCountryCode: false }, // 信用卡配置 card: { type: 'visa' } }; /** * 输出格式 */ const OUTPUT_FORMATS = { json: { name: 'JSON格式', formatter: (account) => JSON.stringify(account, null, 2) }, table: { name: '表格格式', formatter: (account) => { const lines = []; lines.push('┌─────────────┬─────────────────────────────────────────┐'); for (const [key, value] of Object.entries(account)) { if (typeof value === 'object' && value !== null) { lines.push(`│ ${key.padEnd(11)} │ ${JSON.stringify(value).padEnd(39)} │`); } else { lines.push(`│ ${key.padEnd(11)} │ ${String(value).padEnd(39)} │`); } } lines.push('└─────────────┴─────────────────────────────────────────┘'); return lines.join('\n'); } }, simple: { name: '简单格式', formatter: (account) => { const lines = []; for (const [key, value] of Object.entries(account)) { if (typeof value === 'object' && value !== null) { lines.push(`${key}: ${JSON.stringify(value)}`); } else { lines.push(`${key}: ${value}`); } } return lines.join('\n'); } } }; module.exports = { DEFAULT_CONFIG, OUTPUT_FORMATS };