1 var createExtremum = require('../internal/createExtremum'),
2 lt = require('../lang/lt');
4 /** Used as references for `-Infinity` and `Infinity`. */
5 var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
8 * Gets the minimum value of `collection`. If `collection` is empty or falsey
9 * `Infinity` is returned. If an iteratee function is provided it's invoked
10 * for each value in `collection` to generate the criterion by which the value
11 * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
12 * arguments: (value, index, collection).
14 * If a property name is provided for `iteratee` the created `_.property`
15 * style callback returns the property value of the given element.
17 * If a value is also provided for `thisArg` the created `_.matchesProperty`
18 * style callback returns `true` for elements that have a matching property
19 * value, else `false`.
21 * If an object is provided for `iteratee` the created `_.matches` style
22 * callback returns `true` for elements that have the properties of the given
23 * object, else `false`.
28 * @param {Array|Object|string} collection The collection to iterate over.
29 * @param {Function|Object|string} [iteratee] The function invoked per iteration.
30 * @param {*} [thisArg] The `this` binding of `iteratee`.
31 * @returns {*} Returns the minimum value.
34 * _.min([4, 2, 8, 6]);
41 * { 'user': 'barney', 'age': 36 },
42 * { 'user': 'fred', 'age': 40 }
45 * _.min(users, function(chr) {
48 * // => { 'user': 'barney', 'age': 36 }
50 * // using the `_.property` callback shorthand
51 * _.min(users, 'age');
52 * // => { 'user': 'barney', 'age': 36 }
54 var min = createExtremum(lt, POSITIVE_INFINITY);