UNPKG

yoastseo-dep

Version:

Yoast clientside page analysis

32 lines (25 loc) 494 B
/** * Interpreters a score and gives it a particular rating. * * @param {Number} score The score to interpreter. * @returns {string} The rating, given based on the score. */ const ScoreToRating = function( score ) { if ( score === -1 ) { return "error"; } if ( score === 0 ) { return "feedback"; } if ( score <= 4 ) { return "bad"; } if ( score > 4 && score <= 7 ) { return "ok"; } if ( score > 7 ) { return "good"; } return ""; }; export default ScoreToRating;