star-ratings
v1.0.0
Published
calculate weighted average to get a rating
Downloads
15
Readme
Star Rating
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.