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

statistics

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statistics - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

mutate.js

2

package.json
{
"name": "statistics",
"version": "3.1.0",
"version": "3.2.0",
"description": "calculate mean standard deviation in one pass",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/dominictarr/statistics",

@@ -29,2 +29,9 @@

## mutating reduce: require('statistics/mutate')
sometimes, a mutating reduce is prefured. this eases garbage collection,
and allows you to maintain a reference to an updating value.
otherwise the api is the same.
## functional is better than object oriented

@@ -31,0 +38,0 @@

var reduce = require('../')
var reduceMutate = require('../mutate')

@@ -24,1 +25,22 @@ var tape = require('tape')

})
tape('statistics as reduce, with mutations', function (t) {
var stats = [1,2,3].reduce(reduceMutate)
t.deepEqual(stats, {
mean: 2,
stdev: Math.sqrt((1*1+2*2+3*3)/3 - 2*2),
sum: 1+2+3,
count: 3,
sqsum: 1*1+2*2+3*3
})
console.log(stats)
t.end()
})
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