text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  var each_1 = require("./each");
  var is_array_1 = require("./is-array");
  var is_function_1 = require("./is-function");
  /**
   * @param {Array} arr The array to iterate over.
   * @param {Function} [fn] The iteratee invoked per element.
   * @return {*} Returns the minimum value.
   * @example
   *
   * var objects = [{ 'n': 1 }, { 'n': 2 }];
   *
   * minBy(objects, function(o) { return o.n; });
   * // => { 'n': 1 }
   *
   * minBy(objects, 'n');
   * // => { 'n': 1 }
   */
  exports.default = (function (arr, fn) {
      if (!is_array_1.default(arr)) {
          return undefined;
      }
      var min = arr[0];
      var minData;
      if (is_function_1.default(fn)) {
          minData = fn(arr[0]);
      }
      else {
          minData = arr[0][fn];
      }
      var data;
      each_1.default(arr, function (val) {
          if (is_function_1.default(fn)) {
              data = fn(val);
          }
          else {
              data = val[fn];
          }
          if (data < minData) {
              min = val;
              minData = data;
          }
      });
      return min;
  });
  //# sourceMappingURL=min-by.js.map