(text: string, quotedRegex: RegExp)
| 7 | const quotedSpanishRegex = /\n*El.*<?\n?.*>?.*\n?escribió:\n?/; |
| 8 | |
| 9 | function cleanUp(text: string, quotedRegex: RegExp) { |
| 10 | const quoted = text.match(quotedRegex); |
| 11 | if (!quoted || !quoted.length) return text; |
| 12 | const splitBy = quoted.shift(); |
| 13 | if (!splitBy) return text; |
| 14 | return text.split(splitBy).shift()?.trim() || text; |
| 15 | } |
| 16 | |
| 17 | export function cleanUpQuotedEmail(text: string) { |
| 18 | return cleanUp(cleanUp(text, quotedSpanishRegex), quotedRegex); |
no outgoing calls
no test coverage detected