react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / math / max.js
80742 viewsvar createExtremum = require('../internal/createExtremum'),1gt = require('../lang/gt');23/** Used as references for `-Infinity` and `Infinity`. */4var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;56/**7* Gets the maximum value of `collection`. If `collection` is empty or falsey8* `-Infinity` is returned. If an iteratee function is provided it is invoked9* for each value in `collection` to generate the criterion by which the value10* is ranked. The `iteratee` is bound to `thisArg` and invoked with three11* arguments: (value, index, collection).12*13* If a property name is provided for `iteratee` the created `_.property`14* style callback returns the property value of the given element.15*16* If a value is also provided for `thisArg` the created `_.matchesProperty`17* style callback returns `true` for elements that have a matching property18* value, else `false`.19*20* If an object is provided for `iteratee` the created `_.matches` style21* callback returns `true` for elements that have the properties of the given22* object, else `false`.23*24* @static25* @memberOf _26* @category Math27* @param {Array|Object|string} collection The collection to iterate over.28* @param {Function|Object|string} [iteratee] The function invoked per iteration.29* @param {*} [thisArg] The `this` binding of `iteratee`.30* @returns {*} Returns the maximum value.31* @example32*33* _.max([4, 2, 8, 6]);34* // => 835*36* _.max([]);37* // => -Infinity38*39* var users = [40* { 'user': 'barney', 'age': 36 },41* { 'user': 'fred', 'age': 40 }42* ];43*44* _.max(users, function(chr) {45* return chr.age;46* });47* // => { 'user': 'fred', 'age': 40 }48*49* // using the `_.property` callback shorthand50* _.max(users, 'age');51* // => { 'user': 'fred', 'age': 40 }52*/53var max = createExtremum(gt, NEGATIVE_INFINITY);5455module.exports = max;565758