2016-03-26 00:00:01 -07:00
|
|
|
define(['./_baseMean', './identity'], function(baseMean, identity) {
|
2015-12-16 17:53:20 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Computes the mean of the values in `array`.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
2016-03-26 00:00:01 -07:00
|
|
|
* @since 4.0.0
|
2015-12-16 17:53:20 -08:00
|
|
|
* @category Math
|
|
|
|
|
* @param {Array} array The array to iterate over.
|
|
|
|
|
* @returns {number} Returns the mean.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.mean([4, 2, 8, 6]);
|
|
|
|
|
* // => 5
|
|
|
|
|
*/
|
|
|
|
|
function mean(array) {
|
2016-03-26 00:00:01 -07:00
|
|
|
return baseMean(array, identity);
|
2015-12-16 17:53:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mean;
|
|
|
|
|
});
|