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

11 lines
221 B
JavaScript

function negate(func) {
if (typeof func !== 'function') {
throw new TypeError('Expected a function');
}
return function (...args) {
return !func.apply(this, args);
};
}
export { negate };