JSFiddle - React, Tailwind, and code Playground
by bg100
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
JavaScript
const items = [
{ tier: "a", species: "z" },
{ tier: "a", species: "x" },
{ tier: "a", species: "y" },
{ tier: "b", species: "w" },
{ tier: "c", species: "q" },
{ tier: "d", species: "p" }
];
const conditions = [
{ tier: "a" },
{ tier: "b" },
//{ species: "p" }
];
const pred = _.cond(_.map(conditions, c => [_.matches(c) , _.stubTrue] ));
const result = _.filter(items, pred);
console.log(result);