(rawValue = '')
| 56 | } |
| 57 | |
| 58 | function normalizeLuckmailBaseUrl(rawValue = '') { |
| 59 | const value = String(rawValue || '').trim(); |
| 60 | if (!value) return DEFAULT_LUCKMAIL_BASE_URL; |
| 61 | |
| 62 | try { |
| 63 | const parsed = new URL(value); |
| 64 | if (!['http:', 'https:'].includes(parsed.protocol)) { |
| 65 | return DEFAULT_LUCKMAIL_BASE_URL; |
| 66 | } |
| 67 | parsed.pathname = parsed.pathname.replace(/\/+$/, ''); |
| 68 | parsed.search = ''; |
| 69 | parsed.hash = ''; |
| 70 | return parsed.toString().replace(/\/$/, ''); |
| 71 | } catch { |
| 72 | return DEFAULT_LUCKMAIL_BASE_URL; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function normalizeLuckmailEmailType(rawValue = '') { |
| 77 | const normalized = String(rawValue || '').trim().toLowerCase(); |
no outgoing calls
no test coverage detected