question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is your feature request related to a problem? Please describe.

Takes a spec object and a test object; returns true if the test satisfies the spec. Each of the spec’s own properties must be a predicate function. Each predicate is applied to the value of the corresponding property of the test object. where returns true if one of the predicates return true, false otherwise. This function is just like R.where but uses boolean OR instead or boolean AND

Describe the solution you’d like

Possible implementation

const whereAny = R.curry((spec, testObj) => {
  for (let [key, fn] of Object.entries(spec)) {
    if (fn(testObj[key])) {return true}
  }
  return false
})

const pred = searchValue => whereAny({
  a: R.includes(searchValue),
  b: R.equals(searchValue),
  x: R.gt(R.__, 3),
  y: R.lt(R.__, 3)
});

Describe alternatives you’ve considered

Additional context

Originally conceived on SO: https://stackoverflow.com/questions/55688667/ramda-whereany R.where - https://ramdajs.com/docs/#where

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
char0ncommented, Oct 4, 2020

@kcouliba you didn’t give me chance to respond to your comment here. It seems that somebody already implemented this function in ramda.

Having said that, we’ll not be incorporated this function into Ramda Adjunct as well. I’m sorry you’d have to go through the trouble of implementing it.

0reactions
kcoulibacommented, Oct 4, 2020

@char0n no problem, I had fun implementing it. I’ll be looking forward to other functions to implement

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL WHERE ANY | WHERE ALL - Dofactory
ANY and ALL operators are used with WHERE or HAVING. ANY and ALL operate on subqueries that return multiple values. ANY returns true...
Read more >
whereAny - The Grails Framework 3.1.1
Defines a new grails.gorm.DetachedCriteria instance that uses a disjunction (logical OR). Examples. Basic query: def query = Person.whereAny { firstName == ...
Read more >
C# (CSharp) SqlBuilder.WhereAny Examples
WhereAny - 1 examples found. These are the top rated real world C# (CSharp) examples of SqlBuilder.WhereAny extracted from open source projects.
Read more >
Ramda: whereAny? - javascript - Stack Overflow
I'm trying to build myself whereAny . Ramda exposes where which checks if every prop it is given satisfies the respective predicate.
Read more >
net.bytebuddy.matcher.ElementMatchers.whereAny java code ...
public static ElementMatcher.Junction > whereNone(ElementMatcher matcher) { return not(whereAny(matcher));
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found