Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "index"

Index

References

Functions

Object literals

References

Option

Re-exports Option

Result

Re-exports Result

Functions

optionDotAll

resultDotAll

  • resultDotAll<T1, E1>(results: [Result<T1, E1>]): Result<[T1], E1>
  • resultDotAll<T1, E1, T2, E2>(results: [Result<T1, E1>, Result<T2, E2>]): Result<[T1, T2], E1 | E2>
  • resultDotAll<T1, E1, T2, E2, T3, E3>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>]): Result<[T1, T2, T3], E1 | E2 | E3>
  • resultDotAll<T1, E1, T2, E2, T3, E3, T4, E4>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>, Result<T4, E4>]): Result<[T1, T2, T3, T4], E1 | E2 | E3 | E4>
  • resultDotAll<T1, E1, T2, E2, T3, E3, T4, E4, T5, E5>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>, Result<T4, E4>, Result<T5, E5>]): Result<[T1, T2, T3, T4, T5], E1 | E2 | E3 | E4 | E5>
  • resultDotAll<T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>, Result<T4, E4>, Result<T5, E5>, Result<T6, E6>]): Result<[T1, T2, T3, T4, T5, T6], E1 | E2 | E3 | E4 | E5 | E6>
  • resultDotAll<T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6, T7, E7>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>, Result<T4, E4>, Result<T5, E5>, Result<T6, E6>, Result<T7, E7>]): Result<[T1, T2, T3, T4, T5, T6, T7], E1 | E2 | E3 | E4 | E5 | E6 | E7>
  • resultDotAll<T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6, T7, E7, T8, E8>(results: [Result<T1, E1>, Result<T2, E2>, Result<T3, E3>, Result<T4, E4>, Result<T5, E5>, Result<T6, E6>, Result<T7, E7>, Result<T8, E8>]): Result<[T1, T2, T3, T4, T5, T6, T7, T8], E1 | E2 | E3 | E4 | E5 | E6 | E7 | E8>
  • resultDotAll<T, E>(results: Result<T, E>[]): Result<T[], E>
  • Transposes an array of results into an result with an array, analagous to how Promise.all() transposes an array of promises into promised array.

    If every result is ok, this method returns result.ok(arr) where arr is an array of the unwrapped Results. Otherwise, this method returns result.err(e) where e is the error value of the first result in the array that was an err.

    Type parameters

    • T1

    • E1

    Parameters

    • results: [Result<T1, E1>]

      A tuple or array of results.

    Returns Result<[T1], E1>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    Parameters

    Returns Result<[T1, T2], E1 | E2>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    Parameters

    Returns Result<[T1, T2, T3], E1 | E2 | E3>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    • T4

    • E4

    Parameters

    Returns Result<[T1, T2, T3, T4], E1 | E2 | E3 | E4>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    • T4

    • E4

    • T5

    • E5

    Parameters

    Returns Result<[T1, T2, T3, T4, T5], E1 | E2 | E3 | E4 | E5>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    • T4

    • E4

    • T5

    • E5

    • T6

    • E6

    Parameters

    Returns Result<[T1, T2, T3, T4, T5, T6], E1 | E2 | E3 | E4 | E5 | E6>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    • T4

    • E4

    • T5

    • E5

    • T6

    • E6

    • T7

    • E7

    Parameters

    Returns Result<[T1, T2, T3, T4, T5, T6, T7], E1 | E2 | E3 | E4 | E5 | E6 | E7>

  • Type parameters

    • T1

    • E1

    • T2

    • E2

    • T3

    • E3

    • T4

    • E4

    • T5

    • E5

    • T6

    • E6

    • T7

    • E7

    • T8

    • E8

    Parameters

    Returns Result<[T1, T2, T3, T4, T5, T6, T7, T8], E1 | E2 | E3 | E4 | E5 | E6 | E7 | E8>

  • Type parameters

    • T

    • E

    Parameters

    Returns Result<T[], E>

Object literals

Const option

option: object

all

all: optionDotAll = optionDotAll

Transposes an array of options into an optional array, analagous to how Promise.all() transposes an array of promises into promised array.

If every option is some, this method returns option.some(arr) where arr is an array of the unwrapped Options. Otherwise, this method returns option.none().

param

A tuple or array of options.

fromVoidable

  • fromVoidable<T>(voidable: T | undefined | null): Option<T>
  • Accepts one argument t, returning none if the t is null or undefined , otherwise returning some(t).

    Type parameters

    • T

    Parameters

    • voidable: T | undefined | null

    Returns Option<T>

none

  • Returns the none variant.

    Corresponds to Rust's Option::None.

    Type parameters

    • T

    Returns Option<T>

some

  • some<T>(value: T): Option<T>
  • Returns a some variant that wraps the provided value.

    Corresponds to Rust's Option::<T>::Some(T).

    Type parameters

    • T

    Parameters

    • value: T

    Returns Option<T>

Const result

result: object

all

all: resultDotAll = resultDotAll

Transposes an array of results into an result with an array, analagous to how Promise.all() transposes an array of promises into promised array.

If every result is ok, this method returns result.ok(arr) where arr is an array of the unwrapped Results. Otherwise, this method returns result.err(e) where e is the error value of the first result in the array that was an err.

param

A tuple or array of results.

err

  • err<E, T>(error: E): Result<T, E>
  • Returns an err variant that wraps the provided value.

    Corresponds to Rust's Result::<T, E>::Err(E).

    Type parameters

    • E

    • T

    Parameters

    • error: E

    Returns Result<T, E>

ok

  • ok<T, E>(value: T): Result<T, E>
  • Returns an ok variant that wraps the provided value.

    Corresponds to Rust's Result::<T, E>::Ok(T).

    Type parameters

    • T

    • E

    Parameters

    • value: T

    Returns Result<T, E>

Generated using TypeDoc