Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/monads/docs/interfaces/either.md

👻 Option, Result, and Either types for TypeScript; Inspired by Rust
Go to Latest
File

@hqoss/monadsGlobalsEither

Interface: Either ‹L, R

Type parameters

L

R

Hierarchy

Index

Properties

Methods

Properties

type

type: symbol

Defined in lib/either/either.ts:14

Methods

isLeft

isLeft(): boolean

Defined in lib/either/either.ts:15

Returns: boolean


isRight

isRight(): boolean

Defined in lib/either/either.ts:16

Returns: boolean


left

left(): Option‹L›

Defined in lib/either/either.ts:17

Returns: Option‹L›


leftAndThen

leftAndThenU›(fn: function): Either‹U, R›

Defined in lib/either/either.ts:18

Type parameters:

U

Parameters:

fn: function

▸ (val: L): Either‹U, R›

Parameters:

Name Type
val L

Returns: Either‹U, R›


map

mapU›(fn: function): Either‹U, U›

Defined in lib/either/either.ts:29

Type parameters:

U

Parameters:

fn: function

▸ (val: L | R): U

Parameters:

Name Type
val L | R

Returns: Either‹U, U›


mapLeft

mapLeftU›(fn: function): Either‹U, R›

Defined in lib/either/either.ts:30

Type parameters:

U

Parameters:

fn: function

▸ (left: L): U

Parameters:

Name Type
left L

Returns: Either‹U, R›


mapRight

mapRightU›(fn: function): Either‹L, U›

Defined in lib/either/either.ts:31

Type parameters:

U

Parameters:

fn: function

▸ (right: R): U

Parameters:

Name Type
right R

Returns: Either‹L, U›


match

matchU›(fn: Match‹L, R, U›): U

Defined in lib/either/either.ts:28

Type parameters:

U

Parameters:

Name Type
fn Match‹L, R, U›

Returns: U


right(): Option‹R›

Defined in lib/either/either.ts:19

Returns: Option‹R›


rightAndThen

rightAndThenU›(fn: function): Either‹L, U›

Defined in lib/either/either.ts:20

Type parameters:

U

Parameters:

fn: function

▸ (val: R): Either‹L, U›

Parameters:

Name Type
val R

Returns: Either‹L, U›


unwrap

unwrap(): L | R

Defined in lib/either/either.ts:21

Returns: L | R


unwrapLeft

unwrapLeft(): L | never

Defined in lib/either/either.ts:22

Returns: L | never


unwrapLeftOr

unwrapLeftOr(other: L): L

Defined in lib/either/either.ts:23

Parameters:

Name Type
other L

Returns: L


unwrapLeftOrElse

unwrapLeftOrElse(fn: function): L

Defined in lib/either/either.ts:24

Parameters:

fn: function

▸ (right: R): L

Parameters:

Name Type
right R

Returns: L


unwrapRight

unwrapRight(): R | never

Defined in lib/either/either.ts:25

Returns: R | never


unwrapRightOr

unwrapRightOr(other: R): R

Defined in lib/either/either.ts:26

Parameters:

Name Type
other R

Returns: R


unwrapRightOrElse

unwrapRightOrElse(fn: function): R

Defined in lib/either/either.ts:27

Parameters:

fn: function

▸ (left: L): R

Parameters:

Name Type
left L

Returns: R