snivilised / lorax

🌟 reactive extensions for go (a pseudo rxgo version 3)
MIT License
4 stars 0 forks source link

define conditional option #300

Closed plastikfan closed 2 months ago

plastikfan commented 2 months ago

When using the WithXXX options, it would be useful if there was a way to specify an option only when a condition is satisfied. To enable this, LoadOptions must be able to ignore nil options, because we need to define an function, let's call it IfO, which takes a boolean and the option and returns the option if the condiion is true, nil otherwise.

    IfO(some-condition, WithXXX(...))