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

backbone-db

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-db - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

26

lib/db.js

@@ -113,2 +113,3 @@ var Backbone = require('backbone');

},
create: function (model, options, cb) {

@@ -135,5 +136,6 @@ debug('CREATE: ' + JSON.stringify(model));

},
find: function (model, options, cb) {
debug("FIND: " + JSON.stringify(model));
this.store().getItem(model.get(model.idAttribute), function (err, data) {
find: function(model, options, cb) {
debug("FIND: "+JSON.stringify(model));
this.store().getItem(model.get(model.idAttribute), function(err, data) {
data = data && JSON.parse(data);

@@ -143,4 +145,5 @@ return cb(data ? null : new Error(), data);

},
findAll: function (model, options, cb) {
debug("FINDALL: " + JSON.stringify(model));
findAll: function(model, options, cb) {
debug("FINDALL: "+JSON.stringify(model));
var self = this;

@@ -166,2 +169,3 @@ var models = [];

},
destroy: function (model, options, cb) {

@@ -182,2 +186,3 @@ debug("DESTROY: " + JSON.stringify(model));

},
update: function (model, options, cb) {

@@ -201,8 +206,11 @@ var self = this;

},
createId: (function (id) {
createId: (function(id) {
return function (model, options, cb) {
debug('createId: ' + id);
if (model.createId) return model.createId(cb);
debug('createId: '+id);
cb(null, id++);
};
})(1),
inc: function (model, options, cb) {

@@ -224,2 +232,3 @@ debug('INC:', options.inc);

},
// expose "raw" storage backend.

@@ -229,2 +238,3 @@ store: function () {

},
sync: function (method, model, options) {

@@ -271,2 +281,2 @@ options = options || {};

Db.sync = Db.prototype.sync;
module.exports = Db;
module.exports = Db;
{
"name": "backbone-db",
"version": "0.3.1",
"version": "0.3.2",
"description": "Key-Value database storage interface, localStorage and in-process implementations",

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

@@ -82,3 +82,22 @@ var Db = require('../');

});
it('should override id creation function', function(t) {
var ABCModel = MyModel.extend({
createId: function(callback) {
callback(null, 'abc');
}
});
var m = new ABCModel();
m.save(null, {
success: function() {
assert.equal(m.id, 'abc');
t();
},
error: function(err) {
console.error(err);
assert.ok(false);
}
});
});
});
});
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