Rename _.sortByMultiple to _.sortByAll.

This commit is contained in:
John-David Dalton
2014-11-24 23:57:07 -08:00
parent c15f5b5106
commit 02a862684d
2 changed files with 14 additions and 14 deletions

View File

@@ -529,9 +529,9 @@
}
/**
* The base implementation of `_.sortBy` and `_.sortByMultiple` which uses
* `comparer` to define the sort order of `array` and replaces criteria objects
* with their corresponding values.
* The base implementation of `_.sortBy` and `_.sortByAll` which uses `comparer`
* to define the sort order of `array` and replaces criteria objects with their
* corresponding values.
*
* @private
* @param {Array} array The array to sort.
@@ -606,7 +606,7 @@
}
/**
* Used by `_.sortByMultiple` to compare multiple properties of each element
* Used by `_.sortByAll` to compare multiple properties of each element
* in a collection and stable sort them in ascending order.
*
* @private
@@ -1020,7 +1020,7 @@
* `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
* `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`,
* `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
* `sortBy`, `sortByMultiple`, `splice`, `take`, `takeRight`, `takeRightWhile`,
* `sortBy`, `sortByAll`, `splice`, `take`, `takeRight`, `takeRightWhile`,
* `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `transform`,
* `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`,
* `without`, `wrap`, `xor`, `zip`, and `zipObject`
@@ -6107,10 +6107,10 @@
* { 'user': 'fred', 'age': 30 }
* ];
*
* _.map(_.sortBy(users, ['user', 'age']), _.values);
* _.map(_.sortByAll(users, ['user', 'age']), _.values);
* // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
*/
function sortByMultiple(collection) {
function sortByAll(collection) {
var args = arguments;
if (args.length == 4 && isIterateeCall(args[1], args[2], args[3])) {
args = [collection, args[1]];
@@ -10004,7 +10004,7 @@
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy;
lodash.sortByMultiple = sortByMultiple;
lodash.sortByAll = sortByAll;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;

View File

@@ -10774,7 +10774,7 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.sortByMultiple');
QUnit.module('lodash.sortByAll');
(function() {
function Pair(a, b, c) {
@@ -10804,17 +10804,17 @@
];
test('should sort mutliple properties in ascending order', 1, function() {
var actual = _.sortByMultiple(objects, ['a', 'b']);
var actual = _.sortByAll(objects, ['a', 'b']);
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1]]);
});
test('should perform a stable sort (test in IE > 8, Opera, and V8)', 1, function() {
var actual = _.sortByMultiple(stableOrder, ['a', 'c']);
var actual = _.sortByAll(stableOrder, ['a', 'c']);
deepEqual(actual, stableOrder);
});
test('should not error on nullish elements', 1, function() {
var actual = _.sortByMultiple(objects.concat(undefined), ['a', 'b']);
var actual = _.sortByAll(objects.concat(undefined), ['a', 'b']);
deepEqual(actual, [objects[2], objects[0], objects[3], objects[1], undefined]);
});
@@ -10826,7 +10826,7 @@
{ 'a': 'y', '0': 2 }
];
var actual = _.reduce([['a']], _.sortByMultiple, objects);
var actual = _.reduce([['a']], _.sortByAll, objects);
deepEqual(actual, [objects[0], objects[2], objects[1], objects[3]]);
});
}());
@@ -13479,7 +13479,7 @@
'sample',
'shuffle',
'sortBy',
'sortByMultiple',
'sortByAll',
'take',
'times',
'toArray',