mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Fixes #2629, by removing the no-longer-used sortedIndex
This commit is contained in:
10
backbone.js
10
backbone.js
@@ -834,16 +834,6 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
// Figure out the smallest index at which a model should be inserted so as
|
||||
// to maintain order.
|
||||
sortedIndex: function(model, value, context) {
|
||||
value || (value = this.comparator);
|
||||
var iterator = _.isFunction(value) ? value : function(model) {
|
||||
return model.get(value);
|
||||
};
|
||||
return _.sortedIndex(this.models, model, iterator, context);
|
||||
},
|
||||
|
||||
// Pluck an attribute from each model in the collection.
|
||||
pluck: function(attr) {
|
||||
return _.invoke(this.models, 'get', attr);
|
||||
|
||||
@@ -1686,7 +1686,6 @@ alert(JSON.stringify(collection));
|
||||
<li><a href="http://underscorejs.org/#min">min</a></li>
|
||||
<li><a href="http://underscorejs.org/#sortBy">sortBy</a></li>
|
||||
<li><a href="http://underscorejs.org/#groupBy">groupBy</a></li>
|
||||
<li><a href="http://underscorejs.org/#sortedIndex">sortedIndex</a></li>
|
||||
<li><a href="http://underscorejs.org/#shuffle">shuffle</a></li>
|
||||
<li><a href="http://underscorejs.org/#toArray">toArray</a></li>
|
||||
<li><a href="http://underscorejs.org/#size">size</a></li>
|
||||
|
||||
@@ -522,18 +522,6 @@ $(document).ready(function() {
|
||||
deepEqual(col.difference([c, d]), [a, b]);
|
||||
});
|
||||
|
||||
test("sortedIndex", function () {
|
||||
var model = new Backbone.Model({key: 2});
|
||||
var collection = new (Backbone.Collection.extend({
|
||||
comparator: 'key'
|
||||
}))([model, {key: 1}]);
|
||||
equal(collection.sortedIndex(model), 1);
|
||||
equal(collection.sortedIndex(model, 'key'), 1);
|
||||
equal(collection.sortedIndex(model, function (model) {
|
||||
return model.get('key');
|
||||
}), 1);
|
||||
});
|
||||
|
||||
test("reset", 12, function() {
|
||||
var resetCount = 0;
|
||||
var models = col.models;
|
||||
|
||||
Reference in New Issue
Block a user