@metreeca/core - v0.9.22
    Preparing search index...

    Function domain

    Constrains numbers and strings to an enumerated domain.

    • Constrains numbers to an enumerated domain.

      Checks the value against the admitted set.

      Parameters

      • values: readonly number[] | undefined

        The admitted values, or undefined to accept any value

      Returns Validator<number>

      A validator reporting a violation if the value is outside values

    • Constrains strings to an enumerated domain.

      Checks the value against the admitted set.

      Parameters

      • values: readonly string[] | undefined

        The admitted values, or undefined to accept any value

      Returns Validator<string>

      A validator reporting a violation if the value is outside values