Binary Operators
The package also provides a set of binary operators that can be used to combine the evaluation of different features. The operators are:
and
: Returnstrue
if the features are evaluated totrue
.or
: Returnstrue
if at least one of the features is evaluated totrue
.iff
: Returnstrue
if the features' evaluation is the same (in type and value).implies
: Returnstrue
if the logical implication between features is correct. Given two features: A and B, on which A implies B; if feature A istrue
, B must be.false
will be returned if not.
The usage of the operators is as follows:
<Feature>
<On expression={and(feature("feature1"), feature("feature2"))}>
<p>Feature 1 and feature 2 are enabled</p>
</On>
...
</Feature>
<Feature>
<On expression={or(feature("feature1"), feature("feature2"))}>
<p>Feature 1 or feature 2 are enabled</p>
</On>
...
</Feature>
<Feature>
<On expression={iff(feature("feature1"), feature("feature2"))}>
<p>Feature 1 has the same evaluation as feature 2</p>
</On>
...
</Feature>
<Feature>
<On expression={implies(feature("feature1"), feature("feature2"))}>
<p>Because Feature 1 is enabled, feature 2 must be</p>
</On>
...
</Feature>