vue-app-sdk
Version:
22 lines (21 loc) • 421 B
JavaScript
import toInteger from "./toInteger.js";
var FUNC_ERROR_TEXT = "Expected a function";
function before(n, func) {
var result;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = void 0;
}
return result;
};
}
export {
before as default
};