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.0 to 0.1.1

16

lib/collection.js

@@ -42,2 +42,18 @@

Collection.prototype.distinct = function (key, query, opts, cb) {
if (arguments.length === 2) {
cb = query;
query = {};
opts = undefined;
}
if (arguments.length === 3) {
cb = opts;
opts = undefined;
}
return this._request('distinct', [key, query], opts, cb);
};
Collection.prototype.insert = function (docs, opts, cb) {

@@ -44,0 +60,0 @@ return this._request('insert', [docs], opts, cb);

@@ -50,2 +50,7 @@

case 'distinct':
debug('distinct(%s, %o)', this.args[0], this.args[1]);
col.distinct(this.args[0], this.args[1], this.opts, cb);
break;
case 'insert':

@@ -52,0 +57,0 @@ debug('insert(%o)', this.args[0]);

2

package.json
{
"name": "albatross",
"version": "0.1.0",
"version": "0.1.1",
"author": "Linus Unnebäck <linus@folkdatorn.se>",

@@ -5,0 +5,0 @@ "repository": {

@@ -101,2 +101,8 @@

#### `distinct(key[, query[, opts]][, cb]) -> (err, list)`
Finds a list of distinct values for the given key.
*note: if you specify `opts` you also need to specify `query`*
#### `insert(docs[, opts][, cb]) -> (err, docs)`

@@ -103,0 +109,0 @@

@@ -158,2 +158,45 @@

describe('#distinct', function () {
it('should find one distinct names', function (done) {
user.distinct('name', { name: 'Linus' }, function (err, res) {
assert.ifError(err);
assert(Array.isArray(res));
assert.equal(res.length, 1);
assert.equal(res[0], 'Linus');
done();
});
});
it('should find some distinct names', function (done) {
user.distinct('name', { name: { $ne: 'Linus' } }, function (err, res) {
assert.ifError(err);
assert(Array.isArray(res));
assert.equal(res.length, 2);
assert.notEqual(res.indexOf('Steve'), -1);
assert.notEqual(res.indexOf('Bob'), -1);
done();
});
});
it('should find all distinct names', function (done) {
user.distinct('name', function (err, res) {
assert.ifError(err);
assert(Array.isArray(res));
assert.equal(res.length, 3);
assert.notEqual(res.indexOf('Linus'), -1);
assert.notEqual(res.indexOf('Steve'), -1);
assert.notEqual(res.indexOf('Bob'), -1);
done();
});
});
});
describe('#insert', function () {

@@ -160,0 +203,0 @@

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