(content: string)
| 62 | } |
| 63 | |
| 64 | function getFirstSentence(content: string) { |
| 65 | // Return the first words of last message. |
| 66 | const words = content.substring(0, 30).split(' ').slice(0, 5); |
| 67 | // Likely a language without spaces in words. |
| 68 | if (words.length < 3) |
| 69 | return words[0].substring(0, 10); |
| 70 | // Join the words but do not exceed 15 characters. |
| 71 | let sentence = ''; |
| 72 | for (const word of words) { |
| 73 | sentence += word + ' '; |
| 74 | if (sentence.length > 15) |
| 75 | break; |
| 76 | } |
| 77 | return sentence; |
| 78 | } |
no outgoing calls
no test coverage detected