INNER CODE UNIT · JavaScript
gradeFor
Manavarya09/design-extract · src/fidelity/index.js:18
export function gradeFor(score) {
if (score == null) return 'unknown';
if (score >= 90) return 'A';
if (score >= 80) return 'B';
if (score >= 70) return 'C';
if (score >= 60) return 'D';
return 'F';
}
/**
* Blend visual + motion fidelity into one score.
* @param {object} args { verify, motion, weights? }
*/
export function combineFidelity({ verify, motion, weights } = {}) {
const visual = verify?.fidelity ?? null;
const motionScore = motion?.score ?? null;
const vw = weights?.visual ?? VISUAL_WEIGHT;
const mw = weights?.motion ?? MOTION_WEIGHT;