@praha/byethrow
    Preparing search index...

    Function combine

    Combines multiple Result or ResultAsync values into a single result. If all inputs are Success, returns a Success with combined values. If any input is a Failure, returns a Failure with an array of all errors.

    The input type (object or array of Results).

    import { Result } from '@praha/byethrow';

    const result = Result.combine({
    a: Result.succeed(1),
    b: Result.succeed('hello'),
    });
    // { type: 'Success', value: { a: 1, b: 'hello' } }
    import { Result } from '@praha/byethrow';

    const result = Result.combine([
    Result.succeed(1),
    Result.succeed(2),
    Result.succeed(3),
    ]);
    // { type: 'Success', value: [1, 2, 3] }
    import { Result } from '@praha/byethrow';

    const result = Result.combine([
    Result.succeed(1),
    Result.fail('error1'),
    Result.fail('error2'),
    ]);
    // { type: 'Failure', error: ['error1', 'error2'] }