@lucid-softworks/function-timeout
v0.1.0
Published
Wrap a sync or async function with a promise deadline.
Maintainers
Readme
@lucid-softworks/function-timeout
Wrap a synchronous or asynchronous function so every call has a promise
deadline. Expiration uses the shared TimeoutError; underlying work is not
cancelled.
import { functionTimeout } from "@lucid-softworks/function-timeout";
const fetchQuickly = functionTimeout(fetch, 2_000);