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

    Function keys

    • Requires keys to be present in an array or object.

      Checks the array indices or the object property names as a whole for the presence of each required key, so membership is stated the same way for either: numeric keys address array positions, string keys object properties.

      Each missing key is reported under a key of its own, so a violation lands where the absent element or property would have been.

      Type Parameters

      • K extends string | number

        The type of the required keys

      Parameters

      • keys: readonly K[] | undefined

        The keys the array or object must contain, or undefined to accept either unconditionally

      Returns Validator<readonly unknown[] | Record<string, unknown>>

      A validator reporting a violation for each required key missing