UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 510 B
//#region src/array/meanOrThrow.d.ts /** * `meanOrThrow(array)` * * Returns the mean (average) value from `array`, or throws an error if the array is empty. * * ```ts * meanOrThrow([1, 2, 3]); // 2 * meanOrThrow([]); // throws FnError * ``` * * ```ts * pipe([1, 2, 3], meanOrThrow()); // 2 * pipe([], meanOrThrow()); // throws FnError * ``` */ declare const meanOrThrow: { (): (target: readonly number[]) => number; (target: readonly number[]): number; }; //#endregion export { meanOrThrow };