Skip to main content

Module: Either

Type Aliases​

Either​

Ƭ Either<LeftValue, RightValue>: Left<LeftValue> | Right<RightValue>

Type constructor for Either. Can be either Right of the value provided, or Left of the error thrown.

Type parameters​

Name
LeftValue
RightValue

Left​

Ƭ Left<Value>: Object

Type constructor for Left. Describes the special object with one property, represented as unique symbol key, holding the provided value type.

Type parameters​

Name
Value

Type declaration​

NameType
[lid]Value

Ƭ Right<Value>: Object

Type constructor for Right. Describes the special object with one property, represented as unique symbol key, holding the provided value type.

Type parameters​

Name
Value

Type declaration​

NameType
[rid]Value

Variables​

lid​

• Const lid: typeof lid

Internal unique identifier for Left.


rid​

• Const rid: typeof rid

Internal unique identifier for Right.

Functions​

either​

▸ either<LeftValue, RightValue>(value): Promise<Either<LeftValue, RightValue>>

Type constructor for Either. Creates either Right of the value provided, or Left of the error thrown.

Type parameters​

Name
LeftValue
RightValue

Parameters​

NameType
value() => Promise<RightValue>

Returns​

Promise<Either<LeftValue, RightValue>>


eitherSync​

▸ eitherSync<LeftValue, RightValue>(value): Either<LeftValue, RightValue>

Type constructor for Either. Creates either Right of the value provided, or Left of the thrown error.

Type parameters​

Name
LeftValue
RightValue

Parameters​

NameType
value() => RightValue

Returns​

Either<LeftValue, RightValue>


left​

▸ left<Value>(value?): Left<Value>

Constructor function for Left. Creates the special object with one property, represented as unique symbol key, holding the provided value.

Type parameters​

NameType
Valueundefined

Parameters​

NameType
value?Value

Returns​

Left<Value>


right​

▸ right<Value>(value?): Right<Value>

Constructor function for Right. Creates the special object with one property, represented as unique symbol key, holding the provided value.

Type parameters​

NameType
Valueundefined

Parameters​

NameType
value?Value

Returns​

Right<Value>