@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 509 B
TypeScript
//#region src/array/minOrThrow.d.ts
/**
* `minOrThrow(target)`
*
* Returns the minimum value from `target` array, or throws an error if the array is empty.
*
* ```ts
* minOrThrow([5, 2, 8, 1]); // 1
* minOrThrow([]); // throws FnError
* ```
*
* ```ts
* pipe([5, 2, 8, 1], minOrThrow()); // 1
* pipe([], minOrThrow()); // throws FnError
* ```
*/
declare const minOrThrow: {
(): (target: readonly number[]) => number;
(target: readonly number[]): number;
};
//#endregion
export { minOrThrow };