Type Alias: CustomValidator<V, R>
说明
本页由源码中的注释生成,内容为英文。
CustomValidator<
V,R> = (value,helpers) =>R|ErrorReport
A custom validation rule given to custom(). It receives the value (converted by the previous rules) and the helpers of the validation, and returns the value to keep (a new one replaces it; undefined keeps it unchanged), or the error returned by helpers.error(code, context) or helpers.message(messages). An error it throws fails the validation with the code any.custom and the error message.
Type Parameters
V
V = any
R
R = V
Parameters
value
V
helpers
CustomHelpers<R>
Returns
R | ErrorReport