X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils.ts;h=f38221692c8e76b06a57605f8a9129e198796cec;hb=6be442e7f2b445044b09d66fb82012fd511f9cc6;hp=7e1c8ef8ba02d6de027418d51912f56968aefb93;hpb=31847469b406e46688d8aafb880e250706dd8aee;p=poolifier.git
diff --git a/src/utils.ts b/src/utils.ts
index 7e1c8ef8..f3822169 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -174,25 +174,31 @@ export const secureRandom = (): number => {
/**
* 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.
@@ -207,7 +213,7 @@ export const max = (...args: number[]): number =>
* @internal
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export const once = (
+export const once = >(
fn: (...args: A) => R,
context: C
): ((...args: A) => R) => {