/**
* 计算array的平均值
* Computes the mean of the values in `array`
* @param {Array} array The array to iterate over
* @returns {number} Returns the mean
* @example
* mean([4, 2, 8, 6])
* // => 5
*/
const NAN = 0 / 0
function baseSum(array) {
var result,
index = -1,
length = array.length
while (++index < length) {
var current = array[index]
if (current !== undefined) {
result = result === undefined ? current : result + current
}
}
return result
}
function mean(array) {
var length = array == null ? 0 : array.length
return length ? baseSum(array) / length : NAN
}
export default mean