extension/script.js
/**
 * Calculates the scores from the three key metrics.
 * - Retweet Score: Difference between retweets and replies
 * - Like Score: Difference between likes and replies
 * - Balanced Score: Like Score and Retweet Score as a 2:1 average
 * - Ratio Richter: Logarithmic scale for the ratio of replies to likes (see: https://www.dataforprogress.org/the-ratio-richter-scale)
 * @param {number} retweets The amount of retweets a tweet has.
 * @param {number} likes The amount of likes a tweet has.
 * @param {number} replies The amount of replies a tweet has.
 * @returns {object} The calculated retweet, like and balanced scores, as well as the ratio richter.
 */
Calculates the scores from the three key metrics.
Calculates the scores from the three key metrics .
function makeScores(retweets, likes, replies) {
    const retweetScore = retweets - replies;
    const likeScore = likes - replies;
    const balancedScore = (retweetScore + 2 * likeScore) / 3;
    const ratioRichter = Math.log(Math.max(replies, 1) / Math.max(likes, 1)) * Math.log10(Math.max(replies, 1));
    return {
        retweetScore,
        likeScore,
        balancedScore,
        ratioRichter,
    };
}
function makeScores ( retweets , likes , replies ) { const retweetScore = retweets - replies ; const likeScore = likes - replies ; const balancedScore = ( retweetScore + 2 * likeScore ) / 3 ; const ratioRichter = Math . log ( Math . max ( replies , 1 ) / Math . max ( likes , 1 ) ) * Math . log10 ( Math . max ( replies , 1 ) ) ; return { retweetScore , likeScore , balancedScore , ratioRichter , } ; }
Calculates the scores from the three key metrics.
Calculates the scores from the three key metrics .