Comparing version 3.1.0 to 3.2.0
{ | ||
"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() | ||
}) | ||
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
3711
6
84
45