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

backbone-child-collections

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-child-collections - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

36

backbone.childCollections.js

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

var async = require('async');
module.exports = function(Backbone) {

@@ -9,19 +11,27 @@

Backbone.Model.prototype.recursiveFetch = function() {
if (!this._child_collections) return;
this._child_collections.forEach(function(collection){
collection.recursiveFetch();
});
Backbone.Model.prototype.visitDepthFirst = function(visitor, done) {
if (!this._child_collections) return done();
async.each(Array.from(this._child_collections), function(collection, callback){
collection.visitDepthFirst(visitor, callback);
}, done);
};
Backbone.Collection.prototype.recursiveFetch = function() {
this.fetch({
success: function() {
this.each(function(m) {
m.recursiveFetch();
});
}.bind(this)
});
Backbone.Collection.prototype.visitDepthFirst = function(visitor, done) {
visitor(this, function(err){
if (err) return done(err);
async.each(this, function(model, callback){
model.visitDepthFirst(visitor, callback);
}, done);
}.bind(this));
};
Backbone.Model.prototype.recursiveFetch =
Backbone.Collection.prototype.recursiveFetch = function(done) {
this.visitDepthFirst(function(collection, callback){
collection.fetch({
success: function() { callback(); },
error: function() { callback(new Error('fetch failed')); }
});
}, done);
};
};
{
"name": "backbone-child-collections",
"version": "0.0.1",
"version": "0.0.2",
"description": "Plugin to allow tracking of child collections on models, and recursive fetching of model/collection trees",

@@ -18,3 +18,6 @@ "main": "backbone.childCollections.js",

},
"homepage": "https://github.com/Coggle/backbone-child-collections#readme"
"homepage": "https://github.com/Coggle/backbone-child-collections#readme",
"dependencies": {
"async": "^1.5.2"
}
}
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