mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Bump to v4.0.0.
This commit is contained in:
21
mean.js
Normal file
21
mean.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./sum'], function(sum) {
|
||||
|
||||
/**
|
||||
* Computes the mean of the values in `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @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) {
|
||||
return sum(array) / (array ? array.length : 0);
|
||||
}
|
||||
|
||||
return mean;
|
||||
});
|
||||
Reference in New Issue
Block a user