Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/validators/optional"

Index

Functions

Functions

optional

  • Make the validator optional. To be optional, the value must be either an empty string or null.

    example
    useForm(({ optional, regex }) => ({
      email: [ optional(regex(/^\S+@\S+$/)) ]
    }));

    Type parameters

    • Params

    Parameters

    • validator: Validator<Params>

      The optional validator.

    • Optional options: RuleOptions

      The validation options.

    Returns Validator<Params>

    The validation object.

Generated using TypeDoc