Skip to content

minOrThrow

Array.minOrThrow(target)

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

Example

ts
import { Array } from "@monstermann/array";

Array.minOrThrow([5, 2, 8, 1]); // 1
Array.minOrThrow([]); // throws FnError
ts
import { Array } from "@monstermann/array";

pipe([5, 2, 8, 1], Array.minOrThrow()); // 1
pipe([], Array.minOrThrow()); // throws FnError