@monstermann/fn
Version:
A utility library for TypeScript.
20 lines • 433 B
TypeScript
//#region src/array/maxOr.d.ts
/**
* `maxOr(array, fallback)`
*
* Returns the maximum value in the number `array`, or `fallback` if the array is empty.
*
* ```ts
* maxOr([1, 3, 2, 5], 0); // 5
* ```
*
* ```ts
* pipe([1, 3, 2, 5], maxOr(0)); // 5
* ```
*/
declare const maxOr: {
<T>(or: T): (target: readonly number[]) => number | T;
<T>(target: readonly number[], or: T): number | T;
};
//#endregion
export { maxOr };