import {
DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS,
EMPTY_FUNCTION,
+ isKillBehavior,
isPlainObject,
median,
round
} from '../utils'
-import { KillBehaviors, isKillBehavior } from '../worker/worker-options'
+import { KillBehaviors } from '../worker/worker-options'
import { CircularArray } from '../circular-array'
import { Queue } from '../queue'
import {
MeasurementStatisticsRequirements,
WorkerChoiceStrategyOptions
} from './pools/selection-strategies/selection-strategies-types'
+import type { KillBehavior } from './worker/worker-options'
/**
* An intentional empty function.
obj !== null &&
obj?.constructor === Object &&
Object.prototype.toString.call(obj) === '[object Object]'
+
+/**
+ * Detects whether the given value is a kill behavior or not.
+ *
+ * @typeParam KB - Which specific KillBehavior type to test against.
+ * @param killBehavior - Which kind of kill behavior to detect.
+ * @param value - Any value.
+ * @returns `true` if `value` was strictly equals to `killBehavior`, otherwise `false`.
+ */
+export const isKillBehavior = <KB extends KillBehavior>(
+ killBehavior: KB,
+ value: unknown
+): value is KB => {
+ return value === killBehavior
+}
*/
export type KillBehavior = keyof typeof KillBehaviors
-/**
- * Detects whether the given value is a kill behavior or not.
- *
- * @typeParam KB - Which specific KillBehavior type to test against.
- * @param killBehavior - Which kind of kill behavior to detect.
- * @param value - Any value.
- * @returns `true` if `value` was strictly equals to `killBehavior`, otherwise `false`.
- */
-export const isKillBehavior = <KB extends KillBehavior>(
- killBehavior: KB,
- value: unknown
-): value is KB => {
- return value === killBehavior
-}
-
/**
* Options for workers.
*/
const { expect } = require('expect')
const {
availableParallelism,
+ isKillBehavior,
isPlainObject,
median,
round
} = require('../lib/utils')
-const {
- isKillBehavior,
- KillBehaviors
-} = require('../lib/worker/worker-options')
+const { KillBehaviors } = require('../lib/worker/worker-options')
describe('Utils test suite', () => {
it('Verify availableParallelism() behavior', () => {