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);