Low-level validation of a string within supported string-s. The matching is case-insensitive.

Hierarchy

  • Validator<string, readonly string[]>
    • OneOfSupportedValidator

Methods

  • Gets the description of expected value according to the specified limits.

    Parameters

    • limits: readonly string[]

    Returns string

  • Validates value to be one of the specified supported values. This can be easily used with an enum.

    Returns

    The specified value if it is valid.

    Throws

    Error with explanatory message without actual value if it is invalid.

    Type Parameters

    • TValue extends string

    Parameters

    • value: unknown
    • supportedValues: readonly TValue[]

    Returns TValue

Generated using TypeDoc