average
average() function
Returns the average of the given (Iterable/AsyncIterable) (mean)
Signature:declare function average<T extends Iterable<number> | AsyncIterable<number>>(iterable: T): ReturnValueType<T>;
Example
average([]); // NaN
average([1, 2, 3, 4, 5]); // 3
await average(toAsync([1, 2, 3, 4, 5])); // 3
// with pipe
pipe(
[1, 2, 3, 4, 5],
average,
); // 3
see pipe