LendAndRegret/node_modules/es-toolkit/dist/compat/function/after.mjs
2026-05-02 17:27:43 +08:00

16 lines
332 B
JavaScript

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