Socket
Socket
Sign inDemoInstall

moving-average

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

8

index.js

@@ -25,8 +25,8 @@ var exp = Math.exp;

function alpha(t, pt) {
return 1 - (exp(- (t - pt) / timespan * 60));
return 1 - (exp(- (t - pt) / timespan));
}
ret.push =

@@ -36,3 +36,3 @@ function push(time, value) {

if (previousTime) {
// calculate moving average

@@ -39,0 +39,0 @@ var a = alpha(time, previousTime);

{
"name": "moving-average",
"version": "0.1.0",
"version": "0.1.1",
"description": "Exponential Moving Average",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -60,4 +60,4 @@ var test = require('tap').test;

var m = ma.movingAverage();
t.ok(m < 7.9);
t.ok(m > 7.8);
t.ok(m < 1.28);
t.ok(m > 1.27);
});

@@ -86,4 +86,4 @@

var v = ma.variance();
t.ok(v > 0.2);
t.ok(v < 2.0001);
t.ok(v > 3.56);
t.ok(v < 3.57);
});

@@ -103,4 +103,4 @@

var v = ma.variance();
t.ok(v > 0);
t.ok(v < 0.0001);
t.ok(v > 0.4);
t.ok(v < 0.5);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc