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

View File

@@ -10774,7 +10774,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.sortByMultiple'); QUnit.module('lodash.sortByAll');
(function() { (function() {
function Pair(a, b, c) { function Pair(a, b, c) {
@@ -10804,17 +10804,17 @@
]; ];
test('should sort mutliple properties in ascending order', 1, function() { 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]]); 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() { 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); deepEqual(actual, stableOrder);
}); });
test('should not error on nullish elements', 1, function() { 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]); deepEqual(actual, [objects[2], objects[0], objects[3], objects[1], undefined]);
}); });
@@ -10826,7 +10826,7 @@
{ 'a': 'y', '0': 2 } { '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]]); deepEqual(actual, [objects[0], objects[2], objects[1], objects[3]]);
}); });
}()); }());
@@ -13479,7 +13479,7 @@
'sample', 'sample',
'shuffle', 'shuffle',
'sortBy', 'sortBy',
'sortByMultiple', 'sortByAll',
'take', 'take',
'times', 'times',
'toArray', 'toArray',