mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v4.0.0.
This commit is contained in:
20
mean.js
Normal file
20
mean.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import sum from './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);
|
||||
}
|
||||
|
||||
export default mean;
|
||||
Reference in New Issue
Block a user