Files
30-seconds-of-code/snippets/negate.md
Michael Gutman 175e127ab5 ADD: negate.md
2017-12-24 01:28:52 -05:00

238 B

negate

Negates a predicate function.

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

const negate = predicate => (...args) => !predicate(...args)

// filter([1, 2, 3, 4, 5, 6], negate(isEven));
// => [1, 3, 5]