Skip to content

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 containing Either values or functions returning an Either.

Return value ​

  • A Success containing an object, array, or tuple of unwrapped values when every entry is a Right.
  • Otherwise, the first Left in declaration order. Functions placed after that Left are not called.

See also ​

Released under the MIT license.