@newdash/newdash
Version:
javascript/typescript utility library
27 lines (26 loc) • 653 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mean = void 0;
const meanBy_1 = __importDefault(require("./meanBy"));
/**
* Computes the mean of the values in `array`.
*
* @since 5.11.0
* @category Math
* @param array The array to iterate over.
* @returns Returns the mean.
* @example
*
* ```js
* mean([4, 2, 8, 6])
* // => 5
* ```
*/
function mean(array) {
return (0, meanBy_1.default)(array, (value) => value);
}
exports.mean = mean;
exports.default = mean;