The @checkdigit/timeout
module implements the recommended Check Digit timeout algorithm for promises.
npm install @checkdigit/timeout
import timeout from '@checkdigit/timeout';
// await a promise, with the default 60 second timeout
await timeout(new Promise(....));
// await a promise, but with a 10 second timeout
await timeout(new Promise(....), { timeout: 10000 });
MIT