average-rating
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,2 @@ | ||
// average-rating@2.0.1, by @ndaidong - built with esbuild at 2022-01-04T03:58:54.537Z - published under MIT license | ||
// average-rating@2.0.2, by @ndaidong - built with esbuild at 2022-06-03T09:32:41.807Z - published under MIT license | ||
// src/main.js | ||
@@ -3,0 +3,0 @@ var score = (p, n) => { |
@@ -1,2 +0,2 @@ | ||
// average-rating@2.0.1, by @ndaidong - built with esbuild at 2022-01-04T03:58:54.537Z - published under MIT license | ||
var AverageRating=(()=>{var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var h=t=>l(t,"__esModule",{value:!0});var i=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},m=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!F.call(t,r)&&(o||r!=="default")&&l(t,r,{get:()=>e[r],enumerable:!(s=d(e,r))||s.enumerable});return t};var a=(t=>(e,o)=>t&&t.get(e)||(o=m(h({}),e,1),t&&t.set(e,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var k={};i(k,{average:()=>N,rate:()=>b,score:()=>x});var x=(t,e)=>{if(t===0&&e===0)return 0;let o=((t+1.9208)/(t+e)-1.96*Math.sqrt(t*e/(t+e)+.9604)/(t+e))/(1+3.8416/(t+e));return Number(o.toFixed(2))},b=t=>{let e=t.length,o=t[0],s=t[e-1],r=(1/(e-1)).toFixed(2),u=e-1;for(let c=1;c<u;c++){let n=(r*c).toFixed(2);s+=t[c]*n,o+=t[u-c]*n}return x(s,o)},N=t=>{let e=t.reduce((u,c)=>u+c,0);if(e===0)return 0;let o=0,s=1;t.forEach(u=>{o+=u*s,s++});let r=o/e;return Number(r.toFixed(1))};return a(k);})(); | ||
// average-rating@2.0.2, by @ndaidong - built with esbuild at 2022-06-03T09:32:41.807Z - published under MIT license | ||
var AverageRating=(()=>{var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},i=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!F.call(t,r)&&r!==o&&l(t,r,{get:()=>e[r],enumerable:!(s=d(e,r))||s.enumerable});return t};var m=t=>i(l({},"__esModule",{value:!0}),t);var N={};h(N,{average:()=>b,rate:()=>a,score:()=>x});var x=(t,e)=>{if(t===0&&e===0)return 0;let o=((t+1.9208)/(t+e)-1.96*Math.sqrt(t*e/(t+e)+.9604)/(t+e))/(1+3.8416/(t+e));return Number(o.toFixed(2))},a=t=>{let e=t.length,o=t[0],s=t[e-1],r=(1/(e-1)).toFixed(2),u=e-1;for(let c=1;c<u;c++){let n=(r*c).toFixed(2);s+=t[c]*n,o+=t[u-c]*n}return x(s,o)},b=t=>{let e=t.reduce((u,c)=>u+c,0);if(e===0)return 0;let o=0,s=1;t.forEach(u=>{o+=u*s,s++});let r=o/e;return Number(r.toFixed(1))};return m(N);})(); |
@@ -1,2 +0,2 @@ | ||
// average-rating@2.0.1, by @ndaidong - built with esbuild at 2022-01-04T03:58:54.537Z - published under MIT license | ||
// average-rating@2.0.2, by @ndaidong - built with esbuild at 2022-06-03T09:32:41.807Z - published under MIT license | ||
var __defProp = Object.defineProperty; | ||
@@ -6,3 +6,2 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __export = (target, all) => { | ||
@@ -12,15 +11,11 @@ for (var name in all) | ||
}; | ||
var __reExport = (target, module2, copyDefault, desc) => { | ||
if (module2 && typeof module2 === "object" || typeof module2 === "function") { | ||
for (let key of __getOwnPropNames(module2)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) | ||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
return to; | ||
}; | ||
var __toCommonJS = /* @__PURE__ */ ((cache) => { | ||
return (module2, temp) => { | ||
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp); | ||
}; | ||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -34,2 +29,3 @@ // src/main.js | ||
}); | ||
module.exports = __toCommonJS(main_exports); | ||
var score = (p, n) => { | ||
@@ -71,3 +67,2 @@ if (p === 0 && n === 0) { | ||
}; | ||
module.exports = __toCommonJS(main_exports); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -74,0 +69,0 @@ 0 && (module.exports = { |
{ | ||
"name": "average-rating-cjs", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "./average-rating.js" | ||
} |
{ | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"name": "average-rating", | ||
@@ -21,3 +21,3 @@ "description": "Calculate average score and rating based on Wilson Score Equation", | ||
"pretest": "npm run lint", | ||
"test": "NODE_ENV=test jest --verbose --coverage=true --unhandled-rejections=strict --detectOpenHandles", | ||
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true --unhandled-rejections=strict --detectOpenHandles", | ||
"build": "node build src/main.js", | ||
@@ -28,15 +28,5 @@ "eval": "node eval", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.16.7", | ||
"esbuild": "^0.14.10", | ||
"jest": "^27.3.1" | ||
"esbuild": "^0.14.42", | ||
"jest": "^28.1.0" | ||
}, | ||
"babel": { | ||
"env": { | ||
"test": { | ||
"plugins": [ | ||
"@babel/plugin-transform-modules-commonjs" | ||
] | ||
} | ||
} | ||
}, | ||
"standard": { | ||
@@ -43,0 +33,0 @@ "ignore": [ |
@@ -7,3 +7,3 @@ # average-rating | ||
[![Coverage Status](https://coveralls.io/repos/github/ndaidong/average-rating/badge.svg)](https://coveralls.io/github/ndaidong/average-rating) | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ndaidong_average-rating&metric=alert_status)](https://sonarcloud.io/dashboard?id=ndaidong_average-rating) | ||
![CodeQL](https://github.com/ndaidong/average-rating/workflows/CodeQL/badge.svg) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
@@ -10,0 +10,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21451
2
15
528