better-returns
    Preparing search index...

    Function all

    • Combines an array of Results into a single Result containing an array of successful values. If all results in the list are Ok, returns an Ok result containing an array of all successful values. If any result in the list is Err, returns the first Err encountered. This is useful for aggregating multiple fallible operations.

      Type Parameters

      • T

        The type of the successful value within each Result.

      • E

        The type of the error value within each Result.

      Parameters

      • list: Result<T, E>[]

        An array of Result instances.

      Returns Result<T[], E>

      An Ok result with an array of values if all were Ok, or the first Err encountered.