Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/poolifier/src/utils.ts

Fast and small web worker pool
Latest
import * as poolifier from "https://deno.land/x/poolifier@v0.3.14/src/utils.ts";

Variables

Returns safe host OS optimized estimate of the default amount of parallelism a pool should use. Always returns a value greater than zero.

Computes the average of the given data set.

Default task name.

An intentional empty function.

Computes the retry delay in milliseconds using an exponential back off algorithm.

Detects whether the given value is an asynchronous function or not.

Indicates if running in Bun runtime.

Indicates if running in Deno runtime.

Detects whether the given value is a kill behavior or not.

Is the given value a plain object?

Returns whether the current environment is a web worker or not.

Returns the maximum of the given numbers. If no numbers are given, -Infinity is returned.

Computes the median of the given data set.

Returns the minimum of the given numbers. If no numbers are given, Infinity is returned.

Wraps a function so that it can only be called once.

Rounds the given number to the given scale. The rounding is done using the "round half away from zero" method.

Generates a cryptographically secure random number in the [0,1[ range

Sleeps for the given amount of milliseconds.