UNPKG

es-toolkit

Version:

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

11 lines (8 loc) 264 B
import { toNumber } from '../util/toNumber.mjs'; function delay(func, wait, ...args) { if (typeof func !== 'function') { throw new TypeError('Expected a function'); } return setTimeout(func, toNumber(wait) || 0, ...args); } export { delay };