star-ratings

1.0.0 • Public • Published

Star Rating

NPM

Calculate the Weighted Average to get a rating. Useful for calculating 5-star or more ratings

example

 
  var starRatings = require('star-ratings');
 
  // [1-star-voters, 2-star-voters, 3-star-voters, 4-star-voters, ...]
  var votes = [12, 234, 456, 767, 566];
  var rating = starRatings(votes);
  console.log(rating); // '3.8'

API.

starRatings(voters#Array)

Returns a string rating that is the weighted average.

install

  $ npm install star-ratings

license

MIT.

/star-ratings/

    Package Sidebar

    Install

    npm i star-ratings

    Weekly Downloads

    6

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • lestoni