Files
30-seconds-of-code/snippets/negate.md
Angelos Chalaris bb722b2eb4 Updated examples
2017-12-27 16:35:25 +02:00

15 lines
267 B
Markdown

### negate
Negates a predicate function.
Take a predicate function and apply `not` 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
```