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

average-rating

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

average-rating - npm Package Compare versions

Comparing version 0.2.1 to 0.2.5

11

package.json
{
"version": "0.2.01",
"version": "0.2.5",
"name": "average-rating",

@@ -16,8 +16,13 @@ "description": "Calculate average score and rating based on Wilson Score Equation",

"scripts": {
"test": "mocha test"
"test": "./node_modules/.bin/mocha",
"coverage": "./node_modules/.bin/nyc mocha",
"report": "npm run coverage && ./node_modules/.bin/nyc report --reporter=lcov",
"coveralls": "npm run report && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
},
"devDependencies": {
"bellajs": "latest",
"chai": "latest",
"coveralls": "latest",
"mocha": "latest",
"chai": "latest"
"nyc": "latest"
},

@@ -24,0 +29,0 @@ "keywords": [

# average-rating
Calculate average and scoring based on Wilson Score Equation
[![NPM](https://badge.fury.io/js/average-rating.svg)](https://badge.fury.io/js/average-rating) ![Travis](https://travis-ci.org/ndaidong/average-rating.svg?branch=master)
[![NPM](https://badge.fury.io/js/average-rating.svg)](https://badge.fury.io/js/average-rating)
![Travis](https://travis-ci.org/ndaidong/average-rating.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/ndaidong/average-rating/badge.svg?branch=master)](https://coveralls.io/github/ndaidong/average-rating?branch=master)

@@ -28,5 +30,3 @@ ![Google app on Google Play](http://i.imgur.com/NgQX5OW.png)

npm install
mocha
npm test
```
_* Ensure that you have [mocha](https://mochajs.org/) installed_

@@ -15,3 +15,3 @@ /**

return r.toFixed(2);
}
};

@@ -49,2 +49,2 @@ module.exports = {

}
}
};
var samples = [
{
rating: [0, 0, 0, 0, 0],
rating: [ 0, 0, 0, 0, 0 ],
expect: {

@@ -8,5 +8,4 @@ average: 0,

}
},
{
rating: [1, 1, 1, 1, 1],
}, {
rating: [ 1, 1, 1, 1, 1 ],
expect: {

@@ -16,5 +15,4 @@ average: 3.0,

}
},
{
rating: [2, 2, 2, 2, 2],
}, {
rating: [ 2, 2, 2, 2, 2 ],
expect: {

@@ -24,5 +22,4 @@ average: 3.0,

}
},
{
rating: [3, 3, 3, 3, 3],
}, {
rating: [ 3, 3, 3, 3, 3 ],
expect: {

@@ -32,5 +29,4 @@ average: 3.0,

}
},
{
rating: [4, 4, 4, 4, 4],
}, {
rating: [ 4, 4, 4, 4, 4 ],
expect: {

@@ -40,5 +36,4 @@ average: 3.0,

}
},
{
rating: [5, 5, 5, 5, 5],
}, {
rating: [ 5, 5, 5, 5, 5 ],
expect: {

@@ -48,5 +43,4 @@ average: 3.0,

}
},
{
rating: [5, 4, 3, 2, 1],
}, {
rating: [ 5, 4, 3, 2, 1 ],
expect: {

@@ -56,5 +50,4 @@ average: 2.3,

}
},
{
rating: [5, 0, 0, 0, 5],
}, {
rating: [ 5, 0, 0, 0, 5 ],
expect: {

@@ -64,5 +57,4 @@ average: 3.0,

}
},
{
rating: [5, 0, 0, 4, 5],
}, {
rating: [ 5, 0, 0, 4, 5 ],
expect: {

@@ -72,5 +64,4 @@ average: 3.3,

}
},
{
rating: [5, 4, 0, 0, 5],
}, {
rating: [ 5, 4, 0, 0, 5 ],
expect: {

@@ -80,5 +71,4 @@ average: 2.7,

}
},
{
rating: [0, 0, 0, 0, 5],
}, {
rating: [ 0, 0, 0, 0, 5 ],
expect: {

@@ -88,5 +78,4 @@ average: 5,

}
},
{
rating: [0, 0, 0, 4, 5],
}, {
rating: [ 0, 0, 0, 4, 5 ],
expect: {

@@ -96,5 +85,4 @@ average: 4.6,

}
},
{
rating: [0, 0, 3, 4, 5],
}, {
rating: [ 0, 0, 3, 4, 5 ],
expect: {

@@ -104,5 +92,4 @@ average: 4.2,

}
},
{
rating: [0, 2, 3, 4, 5],
}, {
rating: [ 0, 2, 3, 4, 5 ],
expect: {

@@ -112,5 +99,4 @@ average: 3.9,

}
},
{
rating: [1, 2, 3, 4, 5],
}, {
rating: [ 1, 2, 3, 4, 5 ],
expect: {

@@ -120,5 +106,4 @@ average: 3.7,

}
},
{
rating: [9524, 4158, 10177, 25971, 68669],
}, {
rating: [ 9524, 4158, 10177, 25971, 68669 ],
expect: {

@@ -128,5 +113,4 @@ average: 4.2,

}
},
{
rating: [134055, 57472, 143135, 365957, 1448459],
}, {
rating: [ 134055, 57472, 143135, 365957, 1448459 ],
expect: {

@@ -133,0 +117,0 @@ average: 4.4,

@@ -23,18 +23,67 @@ /**

let samples = [
{p: 0, n: 1, e: 0},
{p: 0, n: 5, e: 0},
{p: 0, n: 10, e: 0},
{p: 0, n: 20, e: 0},
{p: 0, n: 100, e: 0},
{p: 0, n: 1000, e: 0},
{n: 0, p: 1, e: 0.21},
{n: 0, p: 5, e: 0.57},
{n: 0, p: 10, e: 0.72},
{n: 0, p: 20, e: 0.84},
{n: 0, p: 100, e: 0.96},
{n: 0, p: 1000, e: 1},
{n: 1, p: 1, e: 0.09},
{n: 5, p: 5, e: 0.24},
{n: 500, p: 500, e: 0.47},
{n: 1000, p: 1000, e: 0.48}
{
p: 0,
n: 1,
e: 0
}, {
p: 0,
n: 5,
e: 0
}, {
p: 0,
n: 10,
e: 0
}, {
p: 0,
n: 20,
e: 0
}, {
p: 0,
n: 100,
e: 0
}, {
p: 0,
n: 1000,
e: 0
}, {
n: 0,
p: 1,
e: 0.21
}, {
n: 0,
p: 5,
e: 0.57
}, {
n: 0,
p: 10,
e: 0.72
}, {
n: 0,
p: 20,
e: 0.84
}, {
n: 0,
p: 100,
e: 0.96
}, {
n: 0,
p: 1000,
e: 1
}, {
n: 1,
p: 1,
e: 0.09
}, {
n: 5,
p: 5,
e: 0.24
}, {
n: 500,
p: 500,
e: 0.47
}, {
n: 1000,
p: 1000,
e: 0.48
}
];

@@ -41,0 +90,0 @@

@@ -10,3 +10,3 @@ 'use strict';

var dirs = ['average', 'rate', 'score'];
var dirs = [ 'average', 'rate', 'score' ];
dirs.forEach((dir) => {

@@ -13,0 +13,0 @@ let where = './test/specs/' + dir;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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