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

calc-stats

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calc-stats - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

8

calc-stats.js

@@ -17,2 +17,3 @@ const { getOrCreateIterator } = require("iter-fun");

calcModes = true,
calcRange = true,
calcSum = true

@@ -26,2 +27,4 @@ } = { debugLevel: 0 }

let needSum = calcSum || calcMean;
let needMin = calcMin || calcRange;
let needMax = calcMax || calcRange;

@@ -38,4 +41,4 @@ let count = 0;

if (needCount) count++;
if (calcMin && (min === undefined || value < min)) min = value;
if (calcMax && (max === undefined || value > max)) max = value;
if (needMin && (min === undefined || value < min)) min = value;
if (needMax && (max === undefined || value > max)) max = value;
if (needSum) sum += value;

@@ -76,2 +79,3 @@ if (needHistogram) {

if (calcSum) results.sum = sum;
if (calcRange) results.range = max - min;
if (calcMean) results.mean = sum / count;

@@ -78,0 +82,0 @@ if (calcHistogram) results.histogram = histogram;

{
"name": "calc-stats",
"version": "0.3.3",
"version": "0.4.0",
"description": "Memory-Aware Statistical Calculations",

@@ -5,0 +5,0 @@ "main": "calc-stats.js",

@@ -37,2 +37,3 @@ # calc-stats

modes: [90, 100], // all the most popular numbers
range: 99, // the difference between max and min
sum: 328350,

@@ -97,6 +98,7 @@ histogram: {

calcModes: false,
calcRange: true,
calcSum: false
};
const results = calcStats(data, options);
// results is { min: 1, max: 100 }
// results is { min: 1, max: 100, range: 99 }
```
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