Skip to content

minOr

ts
function Array.minOr<T>(
    target: readonly number[],
    or: T,
): number | T

Returns the minimum value in the number array, or fallback if the array is empty.

Example

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

Array.minOr([5, 1, 3, 2], 0); // 1
ts
import { Array } from "@monstermann/array";

pipe([5, 1, 3, 2], Array.minOr(0)); // 1