Cleaned up the current snippets for consistency and minor problems, added multiple tags to most of them, archived a few.
15 lines
286 B
Markdown
15 lines
286 B
Markdown
### negate
|
|
|
|
Negates a predicate function.
|
|
|
|
Take a predicate function and apply the not operator (`!`) to it with its arguments.
|
|
|
|
```js
|
|
const negate = func => (...args) => !func(...args);
|
|
```
|
|
|
|
```js
|
|
filter([1, 2, 3, 4, 5, 6], negate(isEven)); // [1, 3, 5]
|
|
negate(isOdd)(1); // false
|
|
```
|