agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
25 lines (21 loc) • 683 B
JavaScript
/**
* @file Format summary header utility
* @description Single responsibility: Format generic summary headers
*/
/**
* Format a generic summary header
* @param {Object} summary - Summary object with common fields
* @param {string} title - Title for the summary
* @param {Object} fields - Field definitions { key: label }
* @returns {string} Formatted summary
*/
function formatSummaryHeader(summary, title, fields) {
let output = `${title}\n\n`;
Object.entries(fields).forEach(([key, label]) => {
if (summary.hasOwnProperty(key)) {
output += ` ${label}: ${summary[key]}\n`;
}
});
return output + '\n';
}
module.exports = formatSummaryHeader;