/**
* Returns the minimum of the given numbers.
- * If no numbers are given, `Infinity` is returned.
+ * If no numbers are given, `Number.POSITIVE_INFINITY` is returned.
*
* @param args - The numbers to get the minimum of.
* @returns The minimum of the given numbers.
* @internal
*/
export const min = (...args: number[]): number =>
- args.reduce((minimum, num) => (minimum < num ? minimum : num), Infinity)
+ args.reduce(
+ (minimum, num) => (minimum < num ? minimum : num),
+ Number.POSITIVE_INFINITY
+ )
/**
* Returns the maximum of the given numbers.
- * If no numbers are given, `-Infinity` is returned.
+ * If no numbers are given, `Number.NEGATIVE_INFINITY` is returned.
*
* @param args - The numbers to get the maximum of.
* @returns The maximum of the given numbers.
* @internal
*/
export const max = (...args: number[]): number =>
- args.reduce((maximum, num) => (maximum > num ? maximum : num), -Infinity)
+ args.reduce(
+ (maximum, num) => (maximum > num ? maximum : num),
+ Number.NEGATIVE_INFINITY
+ )
/**
* Wraps a function so that it can only be called once.
* @internal
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export const once = <A extends any[], R, C>(
+export const once = <A extends any[], R, C extends ThisType<any>>(
fn: (...args: A) => R,
context: C
): ((...args: A) => R) => {