Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-relations

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-relations - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

56

dist/backbone-relations.js

@@ -98,12 +98,15 @@ // Generated by CoffeeScript 1.4.0

(models.filters = {})[theirs] = model;
model.listenTo(ctor.cache(), "add change:" + theirs, function(other) {
models.listenTo(ctor.cache(), 'add', function(other) {
if (model.id && model.id == other.get(theirs)) {
return models.add(other);
return this.add(other);
}
});
model.listenTo(models, "change:" + theirs, function(other, val) {
if (!model.id == val) {
return models.remove(other);
models.listenTo(ctor.cache(), "change:" + theirs, function(other, val) {
if (model.id == val) {
return this.add(other);
}
});
models.on("change:" + theirs, function(other, val) {
return this.remove(other);
});
if (model.id) {

@@ -116,3 +119,3 @@ return models.add(ctor.cache().filter(function(other) {

hasManyVia = function(model, name, rel) {
var attrs, ctor, mine, models, other, otherModel, theirs, via, viaCtor, _i, _len, _ref, _results,
var attrs, ctor, mine, models, theirs, via, viaCtor,
_this = this;

@@ -134,38 +137,17 @@ ctor = getCtor(rel.hasMany);

attrs = {};
model.listenTo(viaCtor.cache(), 'add', function(other) {
var otherModel;
if (!(model.id && model.id == other.get(mine) && (otherModel = ctor.cache().get(other.get(theirs))))) {
return;
via.listenTo(viaCtor.cache(), 'add', function(other) {
if (model.id && model.id == other.get(mine)) {
return this.add(other);
}
via.add(other);
return models.add(otherModel);
});
model.listenTo(ctor.cache(), 'add', function(other) {
var otherVia;
if (!((attrs[mine] = model.id) && (attrs[theirs] = other.id) && (otherVia = via.get(viaCtor.prototype._generateId(attrs))))) {
return;
}
via.add(otherVia);
return models.add(other);
models.listenTo(via, 'add', function(other) {
return this.add(ctor.cache().get(other.get(theirs)));
});
model.listenTo(via, 'remove', function(other) {
return models.remove(models.get(other.get(theirs)));
models.listenTo(via, 'remove', function(other, val) {
return this.remove(ctor.cache().get(other.get(theirs)));
});
model.listenTo(models, 'remove', function(other) {
attrs[mine] = model.id;
attrs[theirs] = other.id;
return via.remove(via.get(viaCtor.prototype._generateId(attrs)));
});
if (model.id) {
_ref = viaCtor.cache().models;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
other = _ref[_i];
if (!(model.id == other.get(mine) && (otherModel = ctor.cache().get(other.get(theirs))))) {
continue;
}
via.add(other);
_results.push(models.add(otherModel));
}
return _results;
return via.add(viaCtor.cache().filter(function(other) {
return model.id == other.get(mine);
}));
}

@@ -172,0 +154,0 @@ };

{
"name": "backbone-relations",
"version": "0.0.9",
"version": "0.0.10",
"author": "Casey Foster <casey@caseywebdev.com>",

@@ -5,0 +5,0 @@ "licence": "MIT",

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