-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackbone.list.min.js
2 lines (2 loc) · 2.24 KB
/
backbone.list.min.js
1
2
/* backbone.list.min.js v0.0.3 */
(function(){var a,b,c,d,e,f,g,h,i,j=[].slice;for(Backbone.List=function(){function a(a,b){null==b&&(b={}),this.reset(a,b),b.noState||addState(this),_.isFunction(this.initialize)&&this.initialize.apply(this,arguments)}return a.prototype.unshift=function(){var a,b,c,d,e,f;for(b=1<=arguments.length?j.call(arguments,0):[],e=b.reverse(),f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(this.add(a,{at:0}));return f},a.prototype.push=function(){var a,b,c,d,e;for(b=1<=arguments.length?j.call(arguments,0):[],e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(this.add(a,{at:this.length}));return e},a.prototype.shift=function(){return this.remove(null,{at:0})},a.prototype.pop=function(){return this.remove(null,{at:this.length-1})},a.prototype.empty=function(){return this.splice(0,1/0)},a.prototype.eventNamespace="listItem:",a.prototype.bubbleEvents=!0,a.prototype.reset=function(a,b){return null==b&&(b={}),this.splice(this.length,this.length),this.push.apply(this,a),b.silent?void 0:this.trigger("reset",this,b)},a.prototype.add=function(a,b){var c,d=this;return null==b&&(b={}),c=null!=b.at?b.at:b.at=this.length,this.bubbleEvents&&a&&_.isFunction(a.on)&&this.listenTo(a,"all",function(){var a,b;return b=arguments[0],a=2<=arguments.length?j.call(arguments,1):[],d.bubbleEvents?d.trigger.apply(d,[""+(d.eventNamespace||"")+d.eventName].concat(j.call(a))):void 0}),this.model&&(a=new this.model(a)),this.splice(c,null,a),b.silent?void 0:this.trigger("add",a,this,b)},a.prototype.remove=function(a,b){var c;return null==b&&(b={}),c=b.at||this.indexOf(a),null==a&&(a=this[c]),this.splice(c,1),b.silent||this.trigger("remove",a,this,b),this.stopListening(a)},a}(),_.extend(Backbone.List.prototype,Backbone.Events),h=["splice","indexOf","lastIndexOf","join","reverse","sort","valueOf","map","forEach","every","reduce","reduceRight","filter","some"],d=0,f=h.length;f>d;d++)a=h[d],(b=Backbone.List.prototype)[a]||(b[a]=arr[a]);for(i=["each","contains","find","filter","reject","contains","max","min","sortBy","groupBy","sortedIndex","shuffle","toArray","size","first","last","initial","rest","without","isEmpty","chain","where","findWhere","clone","pluck","invoke"],e=0,g=i.length;g>e;e++)a=i[e],(c=Backbone.List.prototype)[a]||(c[a]=_[a]);Backbone.List.VERSION="0.0.3"}).call(this);