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.

Optional condition value

See original GitHub issue

Hello,

I have some operators that doesn’t require a condition value (EXISTS, NOT EXISTS)

Could it be made optional ? I can pass value: null but would be better to just not pass it at all. 👍

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
CacheControlcommented, Jul 24, 2017

@jgoux Sorry for the delayed response; I’ve been busy.

I see your point, and I think it’s a good one. There’s a couple considerations we’d need to think about and investigate before this change could be implemented:

  • Developer friendliness; if a value prop is not provided, is that most likely due to programmer error (a bug)? If so, does value of allowing undefined properties outweight the cost of allowing devs to potentially shoot themselves in the foot?
  • json serialization does not include undefined properties. does that matter / do we care?
  • due diligence around the code itself to ensure things won’t break by allowing undefined values.

For now your best bet is to simply add those explicit nulls, which it sounds like you’ve already done.

1reaction
jgouxcommented, Jul 11, 2017

This is what I actually use to define my exists and not exists operators. The thing is I don’t need the jsonValue part, because the operator is opering only on the factValue. It’s just something like : factValue => factValue !== undefined.

So the logic would be to not have to specify a value key in the condition, but if I omit it, it raises an error about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optional search condition in SQL Server - Stack Overflow
I am trying to create a query where when you do not input value in @date variable it will ...
Read more >
Conditional optional checks - Using Swift
I have two optional properties and would like to know how to elegantly unwrap them to perform a conditional check.
Read more >
std::optional - cppreference.com
The class template std::optional manages an optional contained value, i.e. a value that may or may not be present. A common use case...
Read more >
Conditions - AWS CloudFormation
The optional Conditions section contains statements that define the circumstances under which entities are created or configured.
Read more >
Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining ( ?. ) operator accesses an object's property or calls a function. If the object accessed or function called is ......
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