Docs (4.0.0)
class Binding method

or

Adds a filter, to perform a logical OR (i.e. ||) operation with another binding.

or<U = any>(source: Binding<U> | string): Binding<T | U>

Summary

This method can be used to combine two bindings logically, using the || operator. The resulting bound value is the value of the other binding, if the current bound value is equal to false (according to the == operator). The result is the value of the current binding, if its value is equal to true.

Parameters

  • source — Another instance of Binding, or a source path that will be passed to bound()

Return value

A new binding, typed as a union of both original types

Example

// A simple boolean OR
bound.boolean("itemFound").or("hasDefault")

// A conditional string binding
bound.string("customer.name")
  .or(bound.strf("Default: %s", "defaultCustomer.name"))

Related