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

backbone-db-redis

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-db-redis - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/collections/mylist.js

20

index.js

@@ -35,2 +35,14 @@ var _ = require('underscore')

},
_getKey: function (model, options) {
var key = '';
if(options.url) {
key = typeof options.url == "function" ? options.url() : options.url;
} else if(model.url) {
key = typeof model.url == "function" ? model.url() : model.url;
} else if(model.id) {
key = model.id;
}
return this.name + (key ? ':' + key : '');
},
findAll: function(model, options, callback) {

@@ -115,10 +127,6 @@ debug('findAll '+model.url());

var types = require('./lib');
Backbone.RedisDb.Set = types.Set;
Backbone.RedisDb.SortedSet = types.SortedSet;
Backbone.RedisDb.Hash = types.Hash;
Backbone.RedisDb.List = types.List;
Backbone.RedisDb.Set = require('./lib/set');
Backbone.RedisDb.Hash = require('./lib/hash');
module.exports = Backbone.RedisDb;

@@ -1,2 +0,2 @@

var Deferred = require('backbone-promises');
var Deferred = require('backbone-deferred');
var Backbone = require('backbone');

@@ -3,0 +3,0 @@ var debug = require('debug')('backbone-db-redis:hash');

@@ -1,2 +0,2 @@

var Deferred = require('backbone-promises');
var Deferred = require('backbone-deferred');
var Backbone = require('backbone');

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

var Deferred = require('backbone-promises');
var Deferred = require('backbone-deferred');
var Backbone = require('backbone');

@@ -49,4 +49,4 @@ var debug = require('debug')('backbone-db-redis:set');

ids.forEach(function(id) {
var model = new self.create({id:id});
var model = new self.model({id:id})
self.add(model);
debug('fetching %s',id);

@@ -209,5 +209,5 @@ model.fetch().done(done).fail(cb);

});
Deferred.Collection.prototype.remove.apply(self, arguments);
return self.defer('remove', opt, function(cb) {
self.srem(ids, function(err, res) {
Deferred.Collection.prototype.remove.call(self, models);
cb(err, res);

@@ -214,0 +214,0 @@ });

@@ -1,2 +0,2 @@

var Deferred = require('backbone-promises');
var Deferred = require('backbone-deferred');
var Backbone = require('backbone');

@@ -3,0 +3,0 @@

{
"name": "backbone-db-redis",
"version": "0.0.1",
"description": "Redis driver for Backbone.Db",
"version": "0.0.2",
"description": "Redis driver for Backbone.Db",
"main": "index.js",

@@ -9,18 +9,4 @@ "scripts": {

},
"author": {
"name": "nomon",
"email": "matti@applifier.com"
},
"repository": {
"type": "git",
"url": "git://github.com/Nomon/backbone-db-redis.git"
},
"keywords": [
"backbone",
"database",
"sync",
"redis",
"models",
"odm"
],
"repository": "",
"author": "Nomon",
"license": "MIT",

@@ -30,14 +16,6 @@ "dependencies": {

"underscore": "~1.4.4",
"redis": "~0.8.4",
"debug": "~0.7.2",
"backbone-db": "~0.0.1",
"redis": "~0.7.2",
"backbone-promises": "~0.0.1"
},
"devDependencies": {
"mocha": "~1.13.0"
},
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/Nomon/backbone-db-redis/issues"
"backbone-deferred": "git+ssh://git@github.com/Applifier/backbone-deferred.git"
}
}

@@ -5,6 +5,5 @@ var assert = require('assert');

var Backbone = require('backbone');
var Deferred = require('backbone-promises');
var Deferred = require('backbone-deferred');
var Model = Deferred.Model;
var Collection = Deferred.Collection;
var store = new RedisDb('test');

@@ -38,10 +37,10 @@

it('should be able to create', function(t) {
testCol.create({"id_check":1},{ wait: true }).then(function(m) {
testCol.create({"id_check":1},{ wait: true }).done(function(m) {
assert(m.get('id_check') == testCol.at(0).get('id_check'));
var m2 = new MyModel({id:1});
m2.fetch().then(function() {
m2.fetch().done(function() {
assert(m.get('id_check') == m2.get('id_check'));
t();
});
}, function(err) {
}).fail(function(err) {
throw err;

@@ -52,13 +51,13 @@ });

var a = new MyCollection();
a.fetch().then(function(c, a) {
a.fetch().done(function(c, a) {
//assert(c.at(0) != null);
t();
},assert);
});
});
it('should have deferred .create', function(t) {
var a = new MyCollection();
a.create({data:"xyz"}).then(function(m) {
a.create({data:"xyz"}).done(function(m) {
assert(m.get("data") == "xyz");
t();
},assert);
});
});

@@ -68,7 +67,7 @@

var a = new MyCollection();
a.fetch().then(function() {
a.fetch().done(function() {
t();
}, assert);
});
});
});
});
var assert = require('assert');
var _ = require('underscore');
var RedisDb = require('../');
var Model = require('backbone-promises').Model;
var Backbone = require('backbone');
var Model = require('backbone-deferred').Model;
var store = new RedisDb('test');
var store = new RedisDb('mymodel');

@@ -12,5 +13,5 @@ var MyModel = Model.extend({

url: function() {
var key = '/mymodel';
var key = 'mymodel';
if(!this.isNew()) {
key += '/' + this.id;
key += ':' + this.id;
}

@@ -27,11 +28,11 @@ return key;

m.db = store;
m.save().then(function() {
m.save().done(function() {
var m2 = new MyModel({id:1});
m2.fetch().then(function() {
m2.fetch().done(function() {
assert.equal(m2.get("asd"),"das");
t();
}, assert);
}, assert);
});
});
});
});
});

Sorry, the diff of this file is not supported yet

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