Cleanup _.sortBy, _.sortByAll, _.sortByOrder, & baseSortByOrder.

This commit is contained in:
jdalton
2015-04-13 08:17:01 -07:00
parent 38ab42f855
commit 63d493aa1f
2 changed files with 52 additions and 61 deletions

View File

@@ -14185,10 +14185,10 @@
}
var objects = [
{ 'a': 'x', 'b': 3, c: 2 },
{ 'a': 'y', 'b': 4, c: 1 },
{ 'a': 'x', 'b': 1, c: 4},
{ 'a': 'y', 'b': 2, c: 3}
{ 'a': 'x', 'b': 3 },
{ 'a': 'y', 'b': 4 },
{ 'a': 'x', 'b': 1 },
{ 'a': 'y', 'b': 2 }
];
var stableOrder = [
@@ -14209,12 +14209,9 @@
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1]]);
});
test('`_.' + methodName + '` should permit function comparators', 1, function() {
function b(obj) {
return obj.b * obj.c;
}
var actual = func(objects, [b, 'a']);
deepEqual(actual, [objects[2], objects[1], objects[0], objects[3]]);
test('`_.' + methodName + '` should support iteratees', 1, function() {
var actual = func(objects, ['a', function(object) { return object.b; }]);
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1]]);
});
test('`_.' + methodName + '` should perform a stable sort (test in IE > 8, Opera, and V8)', 1, function() {