UNPKG

es-toolkit

Version:

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

16 lines (13 loc) 332 B
import { toInteger } from '../util/toInteger.mjs'; function after(n, func) { if (typeof func !== 'function') { throw new TypeError('Expected a function'); } n = toInteger(n); return function (...args) { if (--n < 1) { return func.apply(this, args); } }; } export { after };