Reputation: 11197
I am currently doing the following:
(projects, query, domain) => compose(
filter<Project>(propEq('domain', domain)),
filter<Project>(propSatisfies(test(new RegExp(query)), 'name')),
)(projects)
However, I was wondering if there was a way to avoid the extra iteration by combining the tests. I looked into and
and allPass
, but neither really meet my parameters. Ideally, I would have something like this:
filter<Project>(
all([
propEq('domain', domain),
propSatisfies(test(new RegExp(query)), 'name'),
]),
);
Is this possible in ramda?
Upvotes: 1
Views: 2093
Reputation: 2828
I guess this should do what you need
filter<Project>(allPass([
propEq('domain', domain),
propSatisfies(test(new RegExp(query)), 'name')
]))
Have you tried that?
Upvotes: 6