meanOrThrow
Array.meanOrThrow(array)
Returns the mean (average) value from array, or throws an error if the array is empty.
Example
ts
import { Array } from "@monstermann/array";
Array.meanOrThrow([1, 2, 3]); // 2
Array.meanOrThrow([]); // throws FnErrorts
import { Array } from "@monstermann/array";
pipe([1, 2, 3], Array.meanOrThrow()); // 2
pipe([], Array.meanOrThrow()); // throws FnError