* The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees
(collection, iteratees, orders)
| 3766 | * @returns {Array} Returns the new sorted array. |
| 3767 | */ |
| 3768 | function baseOrderBy(collection, iteratees, orders) { |
| 3769 | if (iteratees.length) { |
| 3770 | iteratees = arrayMap(iteratees, function(iteratee) { |
| 3771 | if (isArray(iteratee)) { |
| 3772 | return function(value) { |
| 3773 | return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); |
| 3774 | }; |
| 3775 | } |
| 3776 | return iteratee; |
| 3777 | }); |
| 3778 | } else { |
| 3779 | iteratees = [identity]; |
| 3780 | } |
| 3781 | |
| 3782 | var index = -1; |
| 3783 | iteratees = arrayMap(iteratees, baseUnary(getIteratee())); |
| 3784 | |
| 3785 | var result = baseMap(collection, function(value, key, collection) { |
| 3786 | var criteria = arrayMap(iteratees, function(iteratee) { |
| 3787 | return iteratee(value); |
| 3788 | }); |
| 3789 | return { 'criteria': criteria, 'index': ++index, 'value': value }; |
| 3790 | }); |
| 3791 | |
| 3792 | return baseSortBy(result, function(object, other) { |
| 3793 | return compareMultiple(object, other, orders); |
| 3794 | }); |
| 3795 | } |
| 3796 | |
| 3797 | /** |
| 3798 | * The base implementation of `_.pick` without support for individual |
no test coverage detected