Left
Defined in: src/util/Either.ts:34
The Left branch — by convention the error / alternative.
Type Parameters
Section titled “Type Parameters”L
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Left<
L>(value):Left<L>
Defined in: src/util/Either.ts:36
Parameters
Section titled “Parameters”L
Returns
Section titled “Returns”Left<L>
Properties
Section titled “Properties”
readonly_tag:"Left"
Defined in: src/util/Either.ts:35
readonlyvalue:L
Defined in: src/util/Either.ts:36
Methods
Section titled “Methods”bimap()
Section titled “bimap()”bimap<
U,V>(onLeft,_onRight):Either<U,V>
Defined in: src/util/Either.ts:51
Map BOTH sides.
Type Parameters
Section titled “Type Parameters”U
V
Parameters
Section titled “Parameters”onLeft
Section titled “onLeft”(l) => U
_onRight
Section titled “_onRight”(r) => V
Returns
Section titled “Returns”Either<U, V>
flatMap()
Section titled “flatMap()”flatMap<
R2>(_f):Either<L,R2>
Defined in: src/util/Either.ts:45
Right-biased flatMap — Left passes through.
Type Parameters
Section titled “Type Parameters”R2
Parameters
Section titled “Parameters”(r) => Either<L, R2>
Returns
Section titled “Returns”Either<L, R2>
fold()
Section titled “fold()”fold<
T>(onLeft,_onRight):T
Defined in: src/util/Either.ts:56
Collapse to a single value.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”onLeft
Section titled “onLeft”(l) => T
_onRight
Section titled “_onRight”(r) => T
Returns
Section titled “Returns”T
forEach()
Section titled “forEach()”forEach(
_f):void
Defined in: src/util/Either.ts:74
Side-effect runs on Right; no-op on Left.
Parameters
Section titled “Parameters”(r) => void
Returns
Section titled “Returns”void
getOrElse()
Section titled “getOrElse()”getOrElse<
U>(fallback):U
Defined in: src/util/Either.ts:62
Left → fallback.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”fallback
Section titled “fallback”U | ((l) => U)
Returns
Section titled “Returns”U
isLeft()
Section titled “isLeft()”isLeft():
this is Left<L>
Defined in: src/util/Either.ts:38
Returns
Section titled “Returns”this is Left<L>
isRight()
Section titled “isRight()”isRight():
this is Right<never>
Defined in: src/util/Either.ts:39
Returns
Section titled “Returns”this is Right<never>
map<
U>(_f):Either<L,U>
Defined in: src/util/Either.ts:42
Right-biased map — Left passes through.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”(r) => U
Returns
Section titled “Returns”Either<L, U>
mapLeft()
Section titled “mapLeft()”mapLeft<
U>(f):Either<U,never>
Defined in: src/util/Either.ts:48
Map the Left side.
Type Parameters
Section titled “Type Parameters”U
Parameters
Section titled “Parameters”(l) => U
Returns
Section titled “Returns”Either<U, never>
orElse()
Section titled “orElse()”orElse<
R2>(alt):Either<L,R2>
Defined in: src/util/Either.ts:69
Left → alternative; Right → self.
Type Parameters
Section titled “Type Parameters”R2
Parameters
Section titled “Parameters”Either<L, R2> | (() => Either<L, R2>)
Returns
Section titled “Returns”Either<L, R2>
swap()
Section titled “swap()”swap():
Either<never,L>
Defined in: src/util/Either.ts:59
Swap the sides.
Returns
Section titled “Returns”Either<never, L>
toNullable()
Section titled “toNullable()”toNullable():
null
Defined in: src/util/Either.ts:77
Optional conversion — Left → null.
Returns
Section titled “Returns”null