agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
17 lines (15 loc) • 470 B
JavaScript
/**
* @file Truncate text with ellipsis
* @description Single responsibility: Shorten text that exceeds maximum length
*/
/**
* Truncate text with ellipsis
* @param {string} text - Text to truncate
* @param {number} maxLength - Maximum length
* @returns {string} Truncated text
*/
function truncateText(text, maxLength = 80) {
if (!text || text.length <= maxLength) return text;
return text.substring(0, maxLength) + '...';
}
module.exports = truncateText;