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
2
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.4.8 to 0.4.9

component.json

17

lib/db.js

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

this.createId(model, options, function (err, id) {
model.set(model.idAttribute, id);
store(model);

@@ -234,8 +233,16 @@ });

createId: (function (id) {
return function (model, options, cb) {
debug('createId: ' + id);
cb(null, id++);
_createDefaultId: (function(id) {
return function(callback) {
debug('_createDefaultId');
callback(null, id++);
};
})(1),
createId: function (model, options, callback) {
debug('createId');
var createIdFn = model.createId ? model.createId : this._createDefaultId;
createIdFn(function (err, id) {
model.set(model.idAttribute, id);
callback(err);
});
},

@@ -242,0 +249,0 @@ inc: function (model, options, cb) {

{
"name": "backbone-db",
"version": "0.4.8",
"version": "0.4.9",
"description": "Key-Value database storage interface, localStorage and in-process implementations",

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

@@ -155,2 +155,15 @@ var assert = require('assert');

});
it('should support custom createId function', function(t) {
var NM = this.Model.extend({
createId: function(cb) {
cb(null, 'test_id');
}
});
var m = new NM();
m.save(null, {success: function() {
assert.equal(m.id, 'test_id');
t();
}});
});
};
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