MCPcopy Create free account
hub / github.com/chiihero/Microsoft-Rewards-Script / validateEmail

Function validateEmail

scripts/utils.js:46–67  ·  view source on GitHub ↗
(email)

Source from the content-addressed store, hash-verified

44}
45
46export function validateEmail(email) {
47 if (!email) {
48 log('ERROR', '缺少 -email 参数')
49 log('ERROR', '用法: node script.js -email you@example.com')
50 process.exit(1)
51 }
52
53 if (typeof email !== 'string') {
54 log('ERROR', `无效的邮箱类型: 期望是字符串, 实际得到 ${typeof email}`)
55 log('ERROR', '用法: node script.js -email you@example.com')
56 process.exit(1)
57 }
58
59 if (!email.includes('@')) {
60 log('ERROR', `无效的邮箱格式: "${email}"`)
61 log('ERROR', '邮箱必须包含 "@" 符号')
62 log('ERROR', '示例: you@example.com')
63 process.exit(1)
64 }
65
66 return email
67}
68
69export function loadJsonFile(possiblePaths, required = true) {
70 for (const filePath of possiblePaths) {

Callers 1

browserSession.jsFile · 0.90

Calls 1

logFunction · 0.85

Tested by

no test coverage detected