Files
30-seconds-of-code/snippets/negate.md
Angelos Chalaris 5df762902a Update negate.md
2017-12-24 13:44:04 +02:00

261 B

negate

Negates a predicate function.

Take a predicate function and apply not to it with its arguments.

const negate = func => (...args) => !fun(...args);
// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
// negate(isOdd)(1) -> false