Socket
Socket
Sign inDemoInstall

sails-disk

Package Overview
Dependencies
141
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

35

index.js

@@ -606,15 +606,19 @@ /**

* @param {Dictionary} query The stage-3 query to perform.
* @param {Function} cb Callback
* @param {Function} done Callback
*/
avg: function avg(datastoreName, query, cb) {
avg: function avg(datastoreName, query, done) {
adapter.find(datastoreName, query, function(err, records) {
if (err) { return cb(err); }
if (err) { return done(err); }
var sum = _.reduce(records, function(memo, row) { return memo + row[query.numericAttrName]; }, 0);
var avg = sum / records.length;
return cb(undefined, avg);
if (records.length === 0) {// see https://github.com/balderdashy/waterline/commit/cea8b5945acddac91bc4ab89a545dad8c25a6ba3
return done(undefined, 0);
} else {
var total = _.reduce(records, function(memo, row) { return memo + row[query.numericAttrName]; }, 0);
var arithmeticMean = total / records.length;
return done(undefined, arithmeticMean);
}
});
});//_∏_

@@ -631,16 +635,19 @@ },

* @param {Dictionary} query The stage-3 query to perform.
* @param {Function} cb Callback
* @param {Function} done Callback
*/
sum: function sum(datastoreName, query, cb) {
sum: function sum(datastoreName, query, done) {
adapter.find(datastoreName, query, function(err, records) {
if (err) { return cb(err); }
if (err) { return done(err); }
var sum = _.reduce(records, function(memo, row) { return memo + row[query.numericAttrName]; }, 0);
return cb(undefined, sum);
if (records.length === 0) {// see https://github.com/balderdashy/waterline/commit/cea8b5945acddac91bc4ab89a545dad8c25a6ba3
return done(undefined, 0);
} else {
var total = _.reduce(records, function(memo, row) { return memo + row[query.numericAttrName]; }, 0);
return done(undefined, total);
}
});
});//_∏_
},

@@ -647,0 +654,0 @@

2

package.json
{
"name": "sails-disk",
"version": "1.0.1",
"version": "1.1.0",
"description": "Persistent local-disk (and/or memory) adapter for Sails.js / Waterline.",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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