@cowwoc/requirements - v4.0.12
    Preparing search index...

    Type Parameters

    • S

      the type of the validator factory

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    context: Map<string, unknown> = ...

    Methods

    • Returns a new factory instance with an independent configuration. This method is commonly used to inherit and update contextual information from the original factory before passing it into a nested operation. For example,

      JavascriptValidators copy = validators.copy();
      copy.getContext().put(json.toString(), "json");
      nestedOperation(copy);

      Returns S

      a copy of this factory

    • Returns the contextual information inherited by validators created out by this factory. The contextual information is a map of key-value pairs that can provide more details about validation failures. For example, if the message is "Password may not be empty" and the map contains the key-value pair {"username": "john.smith"}, the error message would be:

      Password may not be empty
      username: john.smith

      Returns Map<string, unknown>

      an unmodifiable map from each entry's name to its value

    • Removes the contextual information of validators created by this factory.

      Parameters

      • name: string

        the parameter name

      Returns this

      this

      TypeError if name is undefined or null

      RangeError if name:

      • contains whitespace
      • is empty

    • Sets the contextual information for validators created by this factory.

      This method adds contextual information to error messages. The contextual information is stored as key-value pairs in a map. Values set by this method may be overridden by ValidatorComponent.withContext.

      Parameters

      • value: unknown

        the value of the entry

      • name: string

        the name of an entry

      Returns this

      this

      TypeError if name is undefined or null

      RangeError if:

      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context