Skip to content

maxOrThrow

maxOrThrow(array)

Returns the maximum value from array, or throws an error if the array is empty.

ts
maxOrThrow([1, 5, 3]); // 5
maxOrThrow([]); // throws FnError
ts
pipe([1, 5, 3], maxOrThrow()); // 5
pipe([], maxOrThrow()); // throws FnError