Skip to content

Instantly share code, notes, and snippets.

@rrmdn
Last active June 12, 2017 12:31
Show Gist options
  • Select an option

  • Save rrmdn/811ac241ee6561eef41ea8aa4e988bcb to your computer and use it in GitHub Desktop.

Select an option

Save rrmdn/811ac241ee6561eef41ea8aa4e988bcb to your computer and use it in GitHub Desktop.
const isInQuantity = R.propOr(0, 'quantity');
const isNotIllegal = R.pathEq(false, ['metadata', 'isIllegal']);
const isGood = R.pathEq('good', ['metadata', 'status']);
const isDamaged = R.pathEq('damaged', ['metadata', 'status']);
const available = R.filter(R.allPass([
isInQuantity,
isNotIllegal,
isGood,
]));
const availableProducts = available(products);
const damaged = R.filter(R.allPass([
isInQuantity,
isNotIllegal,
isDamaged,
]));
const damagedProducts = damaged(products);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment