agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
21 lines (19 loc) • 611 B
JavaScript
/**
* @file Format progress utility
* @description Single responsibility: Create progress indicators
*/
/**
* Create a progress indicator for large operations
* @param {number} current - Current item
* @param {number} total - Total items
* @param {string} label - Progress label
* @returns {string} Progress string
*/
function formatProgress(current, total, label = 'Processing') {
if (total === 0) {
return `${label}: ${current}/0 (0%)`;
}
const percentage = Math.round((current / total) * 100);
return `${label}: ${current}/${total} (${percentage}%)`;
}
module.exports = formatProgress;