Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / math / min.js
1 var createExtremum = require('../internal/createExtremum'),
2     lt = require('../lang/lt');
3
4 /** Used as references for `-Infinity` and `Infinity`. */
5 var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
6
7 /**
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).
13  *
14  * If a property name is provided for `iteratee` the created `_.property`
15  * style callback returns the property value of the given element.
16  *
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`.
20  *
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`.
24  *
25  * @static
26  * @memberOf _
27  * @category Math
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.
32  * @example
33  *
34  * _.min([4, 2, 8, 6]);
35  * // => 2
36  *
37  * _.min([]);
38  * // => Infinity
39  *
40  * var users = [
41  *   { 'user': 'barney', 'age': 36 },
42  *   { 'user': 'fred',   'age': 40 }
43  * ];
44  *
45  * _.min(users, function(chr) {
46  *   return chr.age;
47  * });
48  * // => { 'user': 'barney', 'age': 36 }
49  *
50  * // using the `_.property` callback shorthand
51  * _.min(users, 'age');
52  * // => { 'user': 'barney', 'age': 36 }
53  */
54 var min = createExtremum(lt, POSITIVE_INFINITY);
55
56 module.exports = min;