group
The group() function aggregates Right values from an object, array, or tuple into a Success. If a value is a Left, it returns the first one encountered in declaration order.
Interactive example
The const generic parameter automatically infers an array literal as a tuple, without an as const assertion.
Syntax
typescript
E.group(group)Parameters
group: Object, array, or tuple containingEithervalues or functions returning anEither.
Return value
- A
Successcontaining an object, array, or tuple of unwrapped values when every entry is aRight. - Otherwise, the first
Leftin declaration order. Functions placed after thatLeftare not called.
See also
asyncGroup- Async version accepting promises orFuturerightPipe- Synchronous pipeline onRightrightAsyncPipe- Async pipeline onRight
