New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

albatross

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

albatross - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

45

lib/request.js

@@ -23,11 +23,21 @@

function returnFirst (err, res) {
if (err) { return cb(err); }
cb(null, res.length > 0 ? res[0] : null);
function cbWriteCount (err, res) {
if (err) return cb(err);
cb(null, res.result.n);
}
function cbFirstOp (err, res) {
if (err) return cb(err);
cb(null, res.ops[0]);
}
function cbAllOps (err, res) {
if (err) return cb(err);
cb(null, res.ops);
}
switch (this.op) {
case 'findById':
debug('findById(%s)', this.args[0].toString());
debug('findOne({ _id: %s })', this.args[0].toString());
col.findOne({ _id: this.args[0] }, null, this.opts, cb);

@@ -57,14 +67,29 @@ break;

case 'insert':
debug('insert(%o)', this.args[0]);
col.insert(this.args[0], this.opts, (Array.isArray(this.args[0]) ? cb : returnFirst));
if (Array.isArray(this.args[0])) {
debug('insertMany(%o)', this.args[0]);
col.insertMany(this.args[0], this.opts, cbAllOps);
} else {
debug('insertOne(%o)', this.args[0]);
col.insertOne(this.args[0], this.opts, cbFirstOp);
}
break;
case 'update':
debug('update(%o, %o)', this.args[0], this.args[1]);
col.update(this.args[0], this.args[1], this.opts, cb);
if (this.opts.multi === true) {
debug('updateMany(%o, %o)', this.args[0], this.args[1]);
col.updateMany(this.args[0], this.args[1], this.opts, cbWriteCount);
} else {
debug('updateOne(%o, %o)', this.args[0], this.args[1]);
col.updateOne(this.args[0], this.args[1], this.opts, cbWriteCount);
}
break;
case 'remove':
debug('remove(%o)', this.args[0]);
col.remove(this.args[0], this.opts, cb);
if (this.opts.single === true) {
debug('removeOne(%o)', this.args[0]);
col.removeOne(this.args[0], this.opts, cbWriteCount);
} else {
debug('removeMany(%o)', this.args[0]);
col.removeMany(this.args[0], this.opts, cbWriteCount);
}
break;

@@ -71,0 +96,0 @@

{
"name": "albatross",
"version": "0.1.3",
"version": "0.2.0",
"license": "MIT",
"author": "Linus Unnebäck <linus@folkdatorn.se>",
"scripts": {
"test": "mocha"
},
"repository": {

@@ -11,8 +14,8 @@ "type": "git",

"dependencies": {
"debug": "^2.1.0",
"mongodb": "^1.4.22"
"debug": "^2.2.0",
"mongodb": "^2.0.33"
},
"devDependencies": {
"mocha": "^2.0.1"
"mocha": "^2.2.5"
}
}
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