(text)
| 34 | } |
| 35 | |
| 36 | function extractVerificationCode(text) { |
| 37 | const source = String(text || ''); |
| 38 | const matchCn = source.match(/(?:代码为|验证码[^0-9]*?)[\s::]*(\d{6})/i); |
| 39 | if (matchCn) return matchCn[1]; |
| 40 | |
| 41 | const matchEn = source.match(/code(?:\s+is|[\s:])+(\d{6})/i); |
| 42 | if (matchEn) return matchEn[1]; |
| 43 | |
| 44 | const matchStandalone = source.match(/\b(\d{6})\b/); |
| 45 | return matchStandalone ? matchStandalone[1] : null; |
| 46 | } |
| 47 | |
| 48 | function extractVerificationCodeFromMessage(message = {}) { |
| 49 | const sender = firstNonEmptyString([ |
no outgoing calls
no test coverage detected