import arrayMap from "./_arrayMap.js";
import baseGet from "./_baseGet.js";
import baseIteratee from "./_baseIteratee.js";
import baseMap from "./_baseMap.js";
import baseSortBy from "./_baseSortBy.js";
import baseUnary from "./_baseUnary.js";
import compareMultiple from "./_compareMultiple.js";
import identity from "./identity.js";
import isArray from "./isArray.js";
function baseOrderBy(collection, iteratees, orders) {
  if (iteratees.length) {
    iteratees = arrayMap(iteratees, function(iteratee) {
      if (isArray(iteratee)) {
        return function(value) {
          return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
        };
      }
      return iteratee;
    });
  } else {
    iteratees = [identity];
  }
  var index = -1;
  iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  var result = baseMap(collection, function(value, key, collection2) {
    var criteria = arrayMap(iteratees, function(iteratee) {
      return iteratee(value);
    });
    return { "criteria": criteria, "index": ++index, "value": value };
  });
  return baseSortBy(result, function(object, other) {
    return compareMultiple(object, other, orders);
  });
}
export {
  baseOrderBy as default
};
//# sourceMappingURL=_baseOrderBy.js.map
