andThenAsyncForResult | Returns Promise<Err(E)> if the input is Err(E) ,
otherwise calls transformer with the value and returns the result.
|
andThenForResult | Returns Err(E) if the input is Err(E) ,
otherwise calls transformer with the value and returns the result.
|
createErr | |
createOk | |
expectErr | Return input as E if the passed input is Err(E) .
Otherwise, throw TypeError with the passed msg .
|
expectOk | Return input as T if the passed input is Ok(T) .
Otherwise, throw TypeError with the passed msg .
|
flattenForResult | Converts from Result<Result<T, E>, E> to Result<T, E>
|
fromPromiseSettledResultToResult | Convert {@link PromiseSettledResult} returned by {@link Promise.allSettled} to Result
|
inspectBothForResult |
- Return input directly.
- This value is passed as the input. But it maybe mutated by calling effector.
- Call okEffector with the inner value of input if input is
Ok(T) .
Otherwise, call errEffector with the inner value if input is Err(E)
- This main purpose is to inspect an inner value in a chained function calling.
If you don't have to do it, you should not mutate the inner value.
if-else statement might be sufficient to mutate the inner value instead of calling this function.
|
inspectErrForResult |
- Return input directly.
- This value is passed as the input. But it maybe mutated by calling effector.
- Call effector with the inner value of input if input is
Err(E) .
- This main purpose is to inspect an inner value in a chained function calling.
If you don't have to do it, you should not mutate the inner value.
if-else statement might be sufficient to mutate the inner value instead of calling this function.
|
inspectOkForResult |
- Return input directly.
- This value is passed as the input. But it maybe mutated by calling effector.
- Call effector with the inner value of input if input is
Ok(T) .
- This main purpose is to inspect an inner value in a chained function calling.
If you don't have to do it, you should not mutate the inner value.
if-else statement might be sufficient to mutate the inner value instead of calling this function.
|
isErr | |
isOk | |
mapAsyncForResult | Maps a Result<T, E> to Result<U, E> by applying a transformer function
to an contained Ok(T) value, leaving an Err(E) value untouched.
|
mapErrAsyncForResult | Maps a Result<T, E> to Result<T, F> by applying a transformer function mapFn<E, F>
to an contained Err(E) value, leaving an Ok(T) value untouched.
|
mapErrForResult | Maps a Result<T, E> to Result<T, F> by applying a transformer function mapFn<E, F>
to an contained Err(E) value, leaving an Ok(T) value untouched.
|
mapForResult | Maps a Result<T, E> to Result<U, E> by applying a transformer function
to an contained Ok(T) value, leaving an Err(E) value untouched.
|
mapOrAsyncForResult | Return the result of transformer with using input as an argument for it if input is Ok(T) .
Otherwise, return defaultValue.
|
mapOrElseAsyncForResult | Maps a Result<T, E> to U by applying transformer to a contained Ok(T) value in input,
or a recoverer function to a contained Err(E) value in input.
This function can be used to unpack a successful result while handling an error.
|
mapOrElseForResult | Maps a Result<T, E> to U by applying transformer to a contained Ok(T) value in input,
or a recoverer function to a contained Err(E) value in input.
This function can be used to unpack a successful result while handling an error.
|
mapOrForResult | Return the result of transformer with using input as an argument for it if input is Ok(T) .
Otherwise, return defaultValue.
|
orElseAsyncForResult | Calls recoverer and return its returned value if the result is Err(E) ,
otherwise returns the Ok(T) value of self.
|
orElseForResult | Calls recoverer and return its returned value if input is Err(E) ,
otherwise returns input as Ok(T) .
This function can be used for control flow based on result values.
|
toNullableFromErr | Unwrap E if input is Err(E) .
Otherwise, return null .
|
toNullableFromOk | Unwrap T if input is Ok(T) .
Otherwise, return null .
|
toUndefinableFromErr | Unwrap E if input is Err(E) .
Otherwise, return undefined .
|
toUndefinableFromOk | Unwrap T if input is Ok(T) .
Otherwise, return undefined .
|
transposeResultToNullable | Transposes a Result of an Nullable<T> into an Nullable<T> of a Result .
|
transposeResultToUndefinable | Transposes a Result of an Undefinable<T> into an Undefinable<T> of a Result .
|
tryCatchIntoResult | This function converts the returend value from producer into Ok(T) .
If producer throw a something, this returns it with wrapping Err(unknown) .
|
tryCatchIntoResultAsync | This function converts the returend value from producer into Ok(T) .
If producer throw a something, this returns it with wrapping Err(unknown) .
|
tryCatchIntoResultWithEnsureError |
- This function converts the returend value from producer into
Ok(T) .
- If producer throw a value that is an instance of
Error of current [realm][realm],
this returns it with wrapping Err(Error) .
- Otherwise, if producer throw a value that is not an instance of current realm including
a one created from cross-ream
Error constructor (e.g. node:vm , iframe),
then this operator creates a new Error object created from the current realm's constructor
and the thrown value to its Error.cause , make it Err(Error) , and return it finally.
|
tryCatchIntoResultWithEnsureErrorAsync |
- This function converts the returend value from producer into
Ok(T) .
- If producer throw a value that is an instance of
Error of current [realm][realm],
this returns it with wrapping Err(Error) .
- Otherwise, if producer throw a value that is not an instance of current realm including
a one created from cross-ream
Error constructor (e.g. node:vm , iframe),
then this operator creates a new Error object created from the current realm's constructor
and the thrown value to its Error.cause , make it Err(Error) , and return it finally.
|
unwrapErr | Return the inner E of a Err(E) .
|
unwrapOk | Return the inner T of a Ok(T) .
|
unwrapOrElseAsyncForResult | Unwraps input, returns the content of an Ok(T) .
If the value is an Err(E) then it calls recoverer with its value.
|
unwrapOrElseForResult | Unwraps a result input, returns the content of an Ok(T) .
If the value is an Err(E) then it calls def with its value.
|
unwrapOrForResult | Unwraps a result input, returns the content of an Ok(T) .
If the value is an Err(E) then return defaultValue.
|
unwrapOrThrowForResult | Unwraps input, returns the content of an Ok(T) .
Otherwise, this function throw a new Error instance with setting the original E
in Err(E) to .cause property of the Error instance.
|