I have a list, which contains items such as this:
[{name:...}, {name:...}], ...
I would like to extract only those elements, where name matches to any in a set of regular expressions.
I was able to do it like so:
const cards = yield ... //Network request to get my list of items
const matchers = [/^Remaining Space:/, /^Remaining Weight:/, /^Gross:/];
const propTester = (prop, pred) => R.pipe(R.prop(prop), R.test(pred));
const extractors = R.ap([propTester('name')], matchers);
const [ spaceCard, weightCard, grossCard ] =
R.ap(R.ap([R.find], extractors), [cards]);
Is there any way to simplify that?