4381b0a3d73c74cbeaa2b63f7d7793d8b0fd955a
[platform/framework/web/crosswalk-tizen.git] /
1 var arrayMin = require('../internal/arrayMin'),
2     createExtremum = require('../internal/createExtremum');
3
4 /**
5  * Gets the minimum value of `collection`. If `collection` is empty or falsey
6  * `Infinity` is returned. If an iteratee function is provided it is invoked
7  * for each value in `collection` to generate the criterion by which the value
8  * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
9  * arguments: (value, index, collection).
10  *
11  * If a property name is provided for `iteratee` the created `_.property`
12  * style callback returns the property value of the given element.
13  *
14  * If a value is also provided for `thisArg` the created `_.matchesProperty`
15  * style callback returns `true` for elements that have a matching property
16  * value, else `false`.
17  *
18  * If an object is provided for `iteratee` the created `_.matches` style
19  * callback returns `true` for elements that have the properties of the given
20  * object, else `false`.
21  *
22  * @static
23  * @memberOf _
24  * @category Math
25  * @param {Array|Object|string} collection The collection to iterate over.
26  * @param {Function|Object|string} [iteratee] The function invoked per iteration.
27  * @param {*} [thisArg] The `this` binding of `iteratee`.
28  * @returns {*} Returns the minimum value.
29  * @example
30  *
31  * _.min([4, 2, 8, 6]);
32  * // => 2
33  *
34  * _.min([]);
35  * // => Infinity
36  *
37  * var users = [
38  *   { 'user': 'barney', 'age': 36 },
39  *   { 'user': 'fred',   'age': 40 }
40  * ];
41  *
42  * _.min(users, function(chr) {
43  *   return chr.age;
44  * });
45  * // => { 'user': 'barney', 'age': 36 }
46  *
47  * // using the `_.property` callback shorthand
48  * _.min(users, 'age');
49  * // => { 'user': 'barney', 'age': 36 }
50  */
51 var min = createExtremum(arrayMin, true);
52
53 module.exports = min;