extension/script.js
/**
 * Determines the category/level a given score falls into.
 * @param {number} score The score to categorize.
 * @param {string} mode The mode this score was calculated with.
 * @returns {object} The level of this tweet, GOOD, BAD or TERRIBLE.
 */
Determines the category/level a given score falls into.
@param {number} score The score to categorize.
@param {string} mode The mode this score was calculated with.
@returns {object} The level of this tweet, GOOD, BAD or TERRIBLE.
Determines the category / level a given score falls into . @param { number } score The score to categorize . @param { string } mode The mode this score was calculated with . @returns { object } The level of this tweet GOOD BAD or TERRIBLE .
function determineLevel(score, mode) {
    if (mode === RICHTER_MODE) {
        switch (true) {
            case score <= OPTIONS.richterLevelGood: return LEVELS.GOOD;
            case score <= OPTIONS.richterLevelBad: return LEVELS.BAD;
            default: return LEVELS.TERRIBLE;
        }
    }
    switch (true) {
        case score >= OPTIONS.balancedLevelGood: return LEVELS.GOOD;
        case score >= OPTIONS.balancedLevelBad: return LEVELS.BAD;
        default: return LEVELS.TERRIBLE;
    }
}
function determineLevel ( score , mode ) { if ( mode === RICHTER_MODE ) { switch ( true ) { case score <= OPTIONS . richterLevelGood : return LEVELS . GOOD ; case score <= OPTIONS . richterLevelBad : return LEVELS . BAD ; default : return LEVELS . TERRIBLE ; } } switch ( true ) { case score >= OPTIONS . balancedLevelGood : return LEVELS . GOOD ; case score >= OPTIONS . balancedLevelBad : return LEVELS . BAD ; default : return LEVELS . TERRIBLE ; } }
Determines the category/level a given score falls into.
Determines the category / level a given score falls into .