Skip to content

Instantly share code, notes, and snippets.

@NathanKleekamp
Created August 22, 2018 00:57
Show Gist options
  • Save NathanKleekamp/21233c6147d866357e435ed36eed5764 to your computer and use it in GitHub Desktop.
Save NathanKleekamp/21233c6147d866357e435ed36eed5764 to your computer and use it in GitHub Desktop.
isOdd utility fn
const complement = fn => (...args) => !fn.apply(null, args);
const isEven = x => x % 2 === 0;
const isOdd = complement(isEven);
isEven(2); // false
isEven(1); // true
isEven(0); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment