UNPKG

typedash

Version:

modern, type-safe collection of utility functions

28 lines (26 loc) 632 B
//#region src/functions/negate/negate.ts /** * Returns a new function that negates the result of the input function. * @param func The input function to negate. * @returns A new function that negates the result of the input function. * @example * ```ts * const isEven = (num: number) => num % 2 === 0; * const isOdd = negate(isEven); * isOdd(1); // true * isOdd(2); // false * ``` */ function negate(func) { return (...args) => { return !func(...args); }; } //#endregion Object.defineProperty(exports, 'negate', { enumerable: true, get: function () { return negate; } }); //# sourceMappingURL=negate-D2skkpOf.cjs.map