mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Update Underscore/Backbone tests and make them passable.
This commit is contained in:
21
vendor/backbone/backbone.js
vendored
21
vendor/backbone/backbone.js
vendored
@@ -977,16 +977,19 @@
|
||||
// normal circumstances, as the set will maintain sort order as each item
|
||||
// is added.
|
||||
sort: function(options) {
|
||||
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
|
||||
var comparator = this.comparator;
|
||||
if (!comparator) throw new Error('Cannot sort a set without a comparator');
|
||||
options || (options = {});
|
||||
|
||||
// Run sort based on type of `comparator`.
|
||||
if (_.isString(this.comparator) || this.comparator.length === 1) {
|
||||
this.models = this.sortBy(this.comparator, this);
|
||||
} else {
|
||||
this.models.sort(_.bind(this.comparator, this));
|
||||
}
|
||||
var length = comparator.length;
|
||||
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
|
||||
|
||||
// Run sort based on type of `comparator`.
|
||||
if (length === 1 || _.isString(comparator)) {
|
||||
this.models = this.sortBy(comparator);
|
||||
} else {
|
||||
this.models.sort(comparator);
|
||||
}
|
||||
if (!options.silent) this.trigger('sort', this, options);
|
||||
return this;
|
||||
},
|
||||
@@ -1144,8 +1147,8 @@
|
||||
// right here:
|
||||
var collectionMethods = { forEach: 3, each: 3, map: 3, collect: 3, reduce: 4,
|
||||
foldl: 4, inject: 4, reduceRight: 4, foldr: 4, find: 3, detect: 3, filter: 3,
|
||||
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 2,
|
||||
contains: 2, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
|
||||
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
|
||||
contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
|
||||
head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
|
||||
without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
|
||||
isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
|
||||
|
||||
Reference in New Issue
Block a user