Files
30-seconds-of-code/snippets/negate.md
Michael Gutman 552830dea2 Fixed styling
2017-12-24 01:36:12 -05:00

251 B

negate

Negates a predicate function.

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

const negate = func => (...args) => {
  return !func(...args);
}

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