@haraldki/jsonaccess
    Preparing search index...

    Function allValid

    • Verifies that all elements of the array or object are valid, i.e. they are not of type JsonAccessError. The function terminates on the first error found.

      NOTE: this works best with a constant tuple or object defined as const, because then, if the test succeeds, no element of the tuple or object is a Maybe anymore:

      const all = {
      a: Maybe<X> = ...
      b: Maybe<Y> = ...
      } as const;
      if (!allValid(all)) return;
      const realA: X = all.a
      const realB: Y = all.b;

      Type Parameters

      • T extends object | readonly unknown[]

      Parameters

      • values: { [K in string | number | symbol]: Maybe<T[K]> }

        an object or array to be inspected

      • trace: boolean = false

        if true, the first error found will be reported to the console

      • firstFail: (e: JsonAccessError) => void = ...

        will be called with the first error found, if any

      Returns values is T