rating-score

    1.0.1 • Public • Published

    rating-score

    You are a web programmer. You have users. Your users rate stuff on your site. You want to put the highest-rated stuff at the top and lowest-rated at the bottom. You need some sort of “score” to sort by.

    – Evan Miller, “How Not To Sort By Average Rating”

    A better way to calculate ranking score to sort things on the web based on user upvotes or “stars”, using lower bound of Wilson score confidence interval for a Bernoulli parameter.

    API

    Table of Contents

    averageToScore

    Calculates the score from the average of all reviews.

    This function is curried.

    Parameters

    • confidence Number
    • averageRating Number Average review score.
    • maxRating Number Maximum review score.
    • totalReviews Number Total number of reviews.

    Returns Number Calculated score.

    starsToScore

    Calculates the score from a list of review counts.

    This function is curried.

    Parameters

    Returns Number Calculated score.

    upvotesToScore

    Calculates the score from the number of upvotes and downvotes.

    This function is curried.

    Parameters

    • confidence Number
    • upvotes Number Number of positive reviews.
    • downvotes Number Number of negative reviews.

    Returns Number Calculated score.

    Keywords

    none

    Install

    npm i rating-score

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    218 kB

    Total Files

    20

    Last publish

    Collaborators

    • s21n