Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

star-ratings

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

star-ratings

calculate weighted average to get a rating

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

Keywords

FAQs

Package last updated on 01 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc