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

    Function entry

    • entry<K, V>(
          entry: readonly [Modal<Validator<K>>, Modal<Validator<V>>],
      ): Validator<readonly [K, V]>

      Constrains an entry.

      Applies a positional template to a key/value pair, either half omitted or disabled to leave it unconstrained. The two halves are typed independently, so a heterogeneous pair is constrained without widening.

      Violations are reported under the entry key, whichever half incurs them, those of the two halves accumulating side by side.

      Instantiated at [string, T], this is the entry validator accepted by the entry mode of object: drop either half to constrain property names alone or property values alone, the report landing under the property name exactly where a template-keyed one would.

      Type Parameters

      • K

        The type of the entry key

      • V

        The type of the entry value

      Parameters

      • entry: readonly [Modal<Validator<K>>, Modal<Validator<V>>]

        The key and value validators as a positional pair: the first constrains the entry key, the second the entry value; an omitted or disabled half accepts the corresponding position

      Returns Validator<readonly [K, V]>

      A validator reporting the violations the entry incurs, keyed by its key