Predicate().valid() method
Adds state callbacks which will be invoked after the predicate function execution every time when it returns true
or a Promise
that fulfills with true
.
Syntax
Parameters
-
callback1, ..., callbackN
Functions to add. The callback functions will be called with the following arguments:validationResult
AValidationResult
object.
Return value
The Predicate
object.
Exceptions
If anything other than a function is passed in the corresponding error will be thrown.
Description
Adds state callbacks to the Predicate
object. Once the Predicate
in the specified state, the corresponding callbacks will be invoked one by one in the order they were added. The main purpose of state callbacks is to perform side effects related to the state. A ValidationResult
object is passed into state callbacks.