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

standard-deviation-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard-deviation-stream - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

21

lib/standard-deviation-stream.js

@@ -35,5 +35,6 @@ module.exports = function (key, redisClient) {

this.oldVariance = 0;
if(redisClient) {
if (redisClient)
redisClient.del(this.saveKey, done);
}
else
done('No redis client was specified when creating this standard deviation stream');
};

@@ -63,9 +64,9 @@

this.restore = function (done) {
if(redisClient) {
if (redisClient) {
var self = this;
redisClient.get(
this.saveKey,
self.saveKey,
function (err, result) {
if (err)
done();
done(err);
else

@@ -87,2 +88,6 @@ {

}
else
{
done('No redis client was specified when creating this standard deviation stream');
}
};

@@ -92,3 +97,3 @@

this.save = function (done) {
if(redisClient) {
if (redisClient) {
var self = this;

@@ -109,3 +114,7 @@

}
else
{
done('No redis client was specified when creating this standard deviation stream');
}
};
};
{
"name": "standard-deviation-stream",
"description": "A basic method for calculating standard deviation on the fly from a stream of numbers.",
"version": "0.0.2",
"version": "0.0.3",
"author": {

@@ -15,5 +15,5 @@ "name": "Nathan Peck",

"dependencies": {
"redis": "0.10.0"
},
"devDependencies": {
"redis": "0.10.0",
"mocha": "1.17.1",

@@ -20,0 +20,0 @@ "chai": "1.8.1",

@@ -129,2 +129,24 @@ var expect = require('chai').expect,

describe('Attempting to use Redis operations without specifying a Redis client', function () {
var nonRedisDeviation = new DeviationStream('test');
it('Attempting to save state should return an error', function () {
nonRedisDeviation.save(function (err) {
expect(err).to.be.a('string');
});
});
it('Attempting to restore state should return an error', function () {
nonRedisDeviation.restore(function (err) {
expect(err).to.be.a('string');
});
});
it('Attempting to clear state should return an error', function () {
nonRedisDeviation.clear(function (err) {
expect(err).to.be.a('string');
});
});
});
describe('Another sanity test', function () {

@@ -131,0 +153,0 @@ before(function () {

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