Start of main content
Negates a predicate function.
- Take a predicate function and apply the not operator (
!) to it with its arguments.
const negate = func => (...args) => !func(...args);
[1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0));
More like this
Creates a function that will invoke a predicate function for the specified property on a given object.
Boolean traps can cause readability and maintainability issues in your code. Learn what they are, how to spot and fix them in this article.