@haraldki/jsonaccess
    Preparing search index...

    Function jsonAsUnion

    • Returns either the data itself, if it is an element of the values, or a JsonAccessError. An input of JsonAccessError is immediately returned.

      Type Parameters

      • PRIMITIVE extends string | number | boolean

      Parameters

      • data: unknown

        supposedly a value contained in the given values

      • values: readonly PRIMITIVE[]

        the allowed values for the data.

      Returns Maybe<PRIMITIVE>

      data, correctly typed, or JsonAccessError