This feature is experimental. It may be changed or removed in a future version without prior notice or deprecation.
This property contains the name of a method that user-defined classes
may implement to hook into the up.util.isBlank()
protocol.
We have a user-defined Account
class that we want to use with up.util.isBlank()
:
class Account {
constructor(email) {
this.email = email
}
[up.util.isBlank.key]() {
return up.util.isBlank(this.email)
}
}
Note that the protocol method is not actually named 'up.util.isBlank.key'
.
Instead it is named after the value of the up.util.isBlank.key
property.
To do so, the code sample above is using a
computed property name
in square brackets.
We may now use Account
instances with up.util.isBlank()
:
foo = new Account('foo@foo.com')
bar = new Account('')
console.log(up.util.isBlank(foo)) // prints false
console.log(up.util.isBlank(bar)) // prints true