UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

24 lines 604 B
//#region src/array/medianOrThrow.d.ts /** * `medianOrThrow(array)` * * Returns the median value from `array`, or throws an error if the array is empty. * * ```ts * medianOrThrow([1, 3, 5]); // 3 * medianOrThrow([1, 2, 3, 4]); // 2.5 * medianOrThrow([]); // throws FnError * ``` * * ```ts * pipe([1, 3, 5], medianOrThrow()); // 3 * pipe([1, 2, 3, 4], medianOrThrow()); // 2.5 * pipe([], medianOrThrow()); // throws FnError * ``` */ declare const medianOrThrow: { (): (target: readonly number[]) => number; (target: readonly number[]): number; }; //#endregion export { medianOrThrow };