agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
16 lines (14 loc) • 476 B
JavaScript
/**
* @file Format percentage values
* @description Single responsibility: Convert decimal values to percentage strings
*/
/**
* Format percentage with specified precision
* @param {number} value - Value to convert to percentage
* @param {number} precision - Decimal places (default: 1)
* @returns {string} Formatted percentage
*/
function formatPercentage(value, precision = 1) {
return `${(value * 100).toFixed(precision)}%`;
}
module.exports = formatPercentage;