@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 495 B
TypeScript
//#region src/array/maxOrThrow.d.ts
/**
* `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
* ```
*/
declare const maxOrThrow: {
(): (target: readonly number[]) => number;
(target: readonly number[]): number;
};
//#endregion
export { maxOrThrow };