UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

12 lines (7 loc) 262 B
'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const timeout = require('./timeout.js'); async function withTimeout(run, ms) { return Promise.race([run(), timeout.timeout(ms)]); } exports.withTimeout = withTimeout;