validate
validate([value])
Effect
Validate the detected value is legal or not.
If validate passed, return the original value or the value after processing. (Because default
and format
can modify the final return value.)
Otherwise, if validate failed, it will throw a ValidateError
. The message prop of ValdiateError
points to the failure reason. You can set some custom error messages by calling error
.
Arguments
[value]
(*) - The value to detect, default isundefined
.
Returns
The original value or the value after processing.
Example
Last updated