MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / sortByOrder

Function sortByOrder

lib/web/jshint.js:8693–8707  ·  view source on GitHub ↗

* This method is like `_.sortByAll` except that it allows specifying the * sort orders of the iteratees to sort by. A truthy value in `orders` will * sort the corresponding property name in ascending order while a falsey * value will sort it in descending order. * * If a pro

(collection, iteratees, orders, guard)

Source from the content-addressed store, hash-verified

8691 * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
8692 */
8693 function sortByOrder(collection, iteratees, orders, guard) {
8694 if (collection == null) {
8695 return [];
8696 }
8697 if (guard && isIterateeCall(iteratees, orders, guard)) {
8698 orders = null;
8699 }
8700 if (!isArray(iteratees)) {
8701 iteratees = iteratees == null ? [] : [iteratees];
8702 }
8703 if (!isArray(orders)) {
8704 orders = orders == null ? [] : [orders];
8705 }
8706 return baseSortByOrder(collection, iteratees, orders);
8707 }
8708
8709 /**
8710 * Performs a deep comparison between each element in `collection` and the

Callers

nothing calls this directly

Calls 3

isIterateeCallFunction · 0.85
baseSortByOrderFunction · 0.85
isArrayFunction · 0.70

Tested by

no test coverage detected