(text: string)
| 2 | import { getTokenCount, isDate, isEmail, isPhoneNumber, isUrl } from "../utils"; |
| 3 | |
| 4 | export function isTextWithSubstance(text: string): boolean { |
| 5 | return ( |
| 6 | // Hack to include multi-line images or links |
| 7 | ["[", "!["].includes(text) || |
| 8 | // If very short number of characters, likely it's not a useful chunk |
| 9 | (text.length > 3 && |
| 10 | !isEmail(text) && |
| 11 | !isPhoneNumber(text) && |
| 12 | !isUrl(text) && |
| 13 | !isDate(text)) |
| 14 | ); |
| 15 | } |
| 16 | |
| 17 | export function splitTextByHeaders( |
| 18 | markdownText: string, |
no test coverage detected