Or, And, & OneOf Helpers

In addition to is and isNot helpers, this library offers additional boolean helpers right out of the box.

All these helpers will return true or false and can be used anywhere in the template

All the values for these helpers can be a raw value or any state value.

or helper

The or helper will return true at least one of the provided values is TRUTHY.

It takes comma-separated arguments and at least two must be provided.

or(VAL1, VAL2, ...VALN) where the values can be anything including a state value.

html`${or(val1, val2)}`

and helper

The and helper will return true if all the values provided are TRUTHY.

It takes comma-separated arguments and at least two must be provided.

and(VAL1, VAL2, ...VALN) where the values can be anything including a state value.

html`${and(val1, val2)}`

oneOf helper

The oneOf helper will take a value or state value and a list of many possible values and return true if the value provided is in that list.

It takes two arguments and both are required.

oneOf(VALUE_OR_STATE, ARRAY_OF_VALUE_OR_STATE) where the values can be anything including a state value.

html`${oneOf(val, ["one", "two", "three"])}`