1 /** Used as the `TypeError` message for "Functions" methods. */
2 var FUNC_ERROR_TEXT = 'Expected a function';
5 * Creates a function that negates the result of the predicate `func`. The
6 * `func` predicate is invoked with the `this` binding and arguments of the
12 * @param {Function} predicate The predicate to negate.
13 * @returns {Function} Returns the new function.
16 * function isEven(n) {
20 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
23 function negate(predicate) {
24 if (typeof predicate != 'function') {
25 throw new TypeError(FUNC_ERROR_TEXT);
28 return !predicate.apply(this, arguments);
32 module.exports = negate;