Fixes #2629, by removing the no-longer-used sortedIndex

This commit is contained in:
Jeremy Ashkenas
2013-09-11 14:49:23 -03:00
parent 4126a58be6
commit 6e5683f606
3 changed files with 0 additions and 23 deletions

View File

@@ -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);

View File

@@ -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>

View File

@@ -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;