unwrapOr

Result.unwrapOr returns the value contained in an Ok and returns the result of calling the provided closure if the result is Err.

Result<T, E>.unwrapOrElse = (op: (err: E) => T) => T;

Example

div(1, 0).unwrapOrElse(() => 0); // => 0