agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
23 lines (20 loc) • 589 B
JavaScript
/**
* @file Score to grade conversion utility
* @description Single responsibility: Convert numeric scores to letter grades
*/
/**
* Convert a numeric score to a letter grade
* @param {number} score - Score from 0-100
* @returns {string} Letter grade (A, B, C, D, F)
*/
function scoreToGrade(score) {
if (typeof score !== 'number' || isNaN(score)) {
throw new TypeError('Score must be a number');
}
if (score >= 90) return 'A';
if (score >= 80) return 'B';
if (score >= 70) return 'C';
if (score >= 60) return 'D';
return 'F';
}
module.exports = scoreToGrade;