UNPKG

@yetnt/ump

Version:

A very useless math package for your complex javascript projects

18 lines 499 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mean = void 0; /** * Find the average number * @param arr Array of numbers * @param round Round off to the nearest number. Default is false */ function mean(arr, round) { let x = 0; for (const number of arr) { x += number; } const mean = x / arr.length; return round === undefined || round === false ? mean : Math.round(mean); } exports.mean = mean; //# sourceMappingURL=Mean.js.map