ampersand-collection
Advanced tools
Comparing version 1.4.0 to 1.4.1
var BackboneEvents = require('backbone-events-standalone'); | ||
var classExtend = require('ampersand-class-extend'); | ||
var isArray = require('is-array'); | ||
var bind = require('amp-bind'); | ||
var extend = require('extend-object'); | ||
@@ -240,3 +241,3 @@ var slice = [].slice; | ||
} else { | ||
this.models.sort(this.comparator.bind(this)); | ||
this.models.sort(bind(this.comparator,this)); | ||
} | ||
@@ -243,0 +244,0 @@ |
{ | ||
"name": "ampersand-collection", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -9,2 +9,3 @@ "bugs": { | ||
"dependencies": { | ||
"amp-bind": "^1.0.1", | ||
"ampersand-class-extend": "^1.0.0", | ||
@@ -11,0 +12,0 @@ "backbone-events-standalone": "0.2.2", |
@@ -168,2 +168,18 @@ var test = require('tape'); | ||
test('comparator as 2 arg has ref to "this"', function(t){ | ||
var boundCollection; | ||
var Coll = Collection.extend({ | ||
comparator: function (m1, m2) { | ||
boundCollection = this; | ||
return 0; | ||
} | ||
}); | ||
var c = new Coll(); | ||
var moe = new Stooge({name: 'moe', id: '1'}); | ||
var larry = new Stooge({name: 'larry', id: '2'}); | ||
c.add([moe, larry]); | ||
t.equal(c,boundCollection); | ||
t.end(); | ||
}); | ||
test('should store reference to parent instance if passed', function (t) { | ||
@@ -170,0 +186,0 @@ var parent = {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41415
665
5
+ Addedamp-bind@^1.0.1
+ Addedamp-bind@1.0.1(transitive)
+ Addedamp-is-function@1.0.1(transitive)
+ Addedamp-is-object@1.0.1(transitive)