repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: fix faire share worker choice stategy internals update
[poolifier.git]
/
src
/
utils.ts
diff --git
a/src/utils.ts
b/src/utils.ts
index d85c5ba58b4988fad867a9b35f9dca5bb5bb2b45..f30e175c05dd9b20561f8b82f36beaa93946584e 100644
(file)
--- a/
src/utils.ts
+++ b/
src/utils.ts
@@
-1,3
+1,5
@@
+import type { WorkerChoiceStrategyOptions } from './pools/selection-strategies/selection-strategies-types'
+
/**
* An intentional empty function.
*/
/**
* An intentional empty function.
*/
@@
-6,7
+8,15
@@
export const EMPTY_FUNCTION: () => void = Object.freeze(() => {
})
/**
})
/**
- * Returns the median of the given data set.
+ * Default worker choice strategy options.
+ */
+export const DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS: WorkerChoiceStrategyOptions =
+ {
+ medRunTime: false
+ }
+
+/**
+ * Compute the median of the given data set.
*
* @param dataSet - Data set.
* @returns The median of the given data set.
*
* @param dataSet - Data set.
* @returns The median of the given data set.
@@
-22,3
+32,9
@@
export const median = (dataSet: number[]): number => {
}
return (sortedDataSet[middleIndex - 1] + sortedDataSet[middleIndex]) / 2
}
}
return (sortedDataSet[middleIndex - 1] + sortedDataSet[middleIndex]) / 2
}
+
+export const isPlainObject = (obj: unknown): boolean =>
+ typeof obj === 'object' &&
+ obj !== null &&
+ obj?.constructor === Object &&
+ Object.prototype.toString.call(obj) === '[object Object]'