Function: unwrapOrUndefined()
Call Signature
unwrapOrUndefined<
R>(result):undefined|UnwrapOk<R>
Defined in: index.ts:453
Unwraps a Result, returning the data for Ok results and undefined for Err results. This is a convenience function that's equivalent to calling unwrapOr(result, undefined).
Type Parameters
R
R extends Result<any, any>
Type of the Result to unwrap
Parameters
result
NonPromise<R>
The Result to unwrap
Returns
undefined | UnwrapOk<R>
Data from the Ok result or undefined for Err results
Example
unwrapOrUndefined(ok("hello")); // "hello"
unwrapOrUndefined(err("error")); // undefinedCall Signature
unwrapOrUndefined<
R>(result):Promise<undefined|UnwrapOk<R>>
Defined in: index.ts:454
Unwraps a Result, returning the data for Ok results and undefined for Err results. This is a convenience function that's equivalent to calling unwrapOr(result, undefined).
Type Parameters
R
R extends OrPromise<Result<any, any>>
Type of the Result to unwrap
Parameters
result
R
The Result to unwrap
Returns
Promise<undefined | UnwrapOk<R>>
Data from the Ok result or undefined for Err results
Example
unwrapOrUndefined(ok("hello")); // "hello"
unwrapOrUndefined(err("error")); // undefined