repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: switch from mitata to tatami-ng
[poolifier.git]
/
src
/
utils.ts
diff --git
a/src/utils.ts
b/src/utils.ts
index a33758ce64c1ad72890b8d6e8b40b96336316c65..c568a29a049eda2de26cf9bd99d63e613294bc3f 100644
(file)
--- a/
src/utils.ts
+++ b/
src/utils.ts
@@
-1,5
+1,6
@@
-import * as os from 'node:os'
import { getRandomValues } from 'node:crypto'
import { getRandomValues } from 'node:crypto'
+import * as os from 'node:os'
+
import type { KillBehavior } from './worker/worker-options.js'
/**
import type { KillBehavior } from './worker/worker-options.js'
/**
@@
-197,18
+198,22
@@
export const max = (...args: number[]): number =>
* @param fn - The function to wrap.
* @param context - The context to bind the function to.
* @returns The wrapped function.
* @param fn - The function to wrap.
* @param context - The context to bind the function to.
* @returns The wrapped function.
+ *
+ * @typeParam A - The function's arguments.
+ * @typeParam R - The function's return value.
+ * @typeParam C - The function's context.
* @internal
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
* @internal
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export const once = <
T, A extends any[], R
>(
+export const once = <
A extends any[], R, C
>(
fn: (...args: A) => R,
fn: (...args: A) => R,
- context:
T
+ context:
C
): ((...args: A) => R) => {
let result: R
return (...args: A) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (fn != null) {
): ((...args: A) => R) => {
let result: R
return (...args: A) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (fn != null) {
- result = fn.apply<
T
, A, R>(context, args)
+ result = fn.apply<
C
, A, R>(context, args)
;(fn as unknown as undefined) = (context as unknown as undefined) =
undefined
}
;(fn as unknown as undefined) = (context as unknown as undefined) =
undefined
}