This common pattern feels a bit verbose:
if (condition) Some(result) else None
I was thinking of using a function to simplify:
You could create the Option first and filter on that with your condition:
Option
Option(result).filter(condition)
or if condition is not related to result
condition
result
Option(result).filter(_ => condition)