Skip to content

Instantly share code, notes, and snippets.

@chalu
Created July 18, 2019 17:45
Show Gist options
  • Select an option

  • Save chalu/d0ab24b09d6e807ae0cf4accd9e79aac to your computer and use it in GitHub Desktop.

Select an option

Save chalu/d0ab24b09d6e807ae0cf4accd9e79aac to your computer and use it in GitHub Desktop.
const is = (target) => (value) => value === target;
const isOver = (target) => (value) => value > target;
const isOrOver = (target) => (value) => value >= target;
// match devs over 24 years old
const olderThan24 = match('age', isOver(24));
const over24s = olderThan24(data);
// match devs at, or over 35 years old
const aged35OrOlder = match('age', isOrOver(35));
const over35s = aged35OrOlder(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment