* Truncates a string to a maximum length with ellipsis * @param {string} str - The string to truncate * @param {number} maxLength - Maximum allowed length * @returns {string} Truncated string with ellipsis if needed
(str, maxLength)
| 192 | * @returns {string} Truncated string with ellipsis if needed |
| 193 | */ |
| 194 | function truncateString(str, maxLength) { |
| 195 | if (!str) return ""; |
| 196 | if (str.length <= maxLength) return str; |
| 197 | return str.substring(0, maxLength) + "..."; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Calculates approximate token count from text using 4 chars per token estimate |
no outgoing calls
no test coverage detected