Skip to content

swap

swap<A, B>(data): These<B, A>

Defined in: Core/These.ts:291

Swaps the roles of first and second values.

  • First(a) → Second(a)
  • Second(b) → First(b)
  • Both(a, b) → Both(b, a)

A

B

These<A, B>

These<B, A>

These.swap(These.first(5));            // Second(5)
These.swap(These.second("warn"));      // First("warn")
These.swap(These.both(5, "warn"));     // Both("warn", 5)