mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v3.7.0.
This commit is contained in:
@@ -1,30 +1,26 @@
|
||||
import baseEach from './baseEach';
|
||||
import arrayMap from './arrayMap';
|
||||
import baseCallback from './baseCallback';
|
||||
import baseMap from './baseMap';
|
||||
import baseSortBy from './baseSortBy';
|
||||
import compareMultiple from './compareMultiple';
|
||||
import isLength from './isLength';
|
||||
|
||||
/**
|
||||
* The base implementation of `_.sortByOrder` without param guards.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {string[]} props The property names to sort by.
|
||||
* @param {boolean[]} orders The sort orders of `props`.
|
||||
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
||||
* @param {boolean[]} orders The sort orders of `iteratees`.
|
||||
* @returns {Array} Returns the new sorted array.
|
||||
*/
|
||||
function baseSortByOrder(collection, props, orders) {
|
||||
var index = -1,
|
||||
length = collection.length,
|
||||
result = isLength(length) ? Array(length) : [];
|
||||
function baseSortByOrder(collection, iteratees, orders) {
|
||||
var index = -1;
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
var length = props.length,
|
||||
criteria = Array(length);
|
||||
iteratees = arrayMap(iteratees, function(iteratee) { return baseCallback(iteratee); });
|
||||
|
||||
while (length--) {
|
||||
criteria[length] = value == null ? undefined : value[props[length]];
|
||||
}
|
||||
result[++index] = { 'criteria': criteria, 'index': index, 'value': value };
|
||||
var result = baseMap(collection, function(value) {
|
||||
var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
|
||||
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
||||
});
|
||||
|
||||
return baseSortBy(result, function(object, other) {
|
||||
|
||||
Reference in New Issue
Block a user