result.valueOr
The value of a success, or a fallback on failure.
Usage
Result.valueOr<T, F>(r: Result<T>, fallback: F): T | FParameters
rResult<T>The result to read.
fallbackFWhat to return when
rfailed.
Returns
The success value, or fallback unchanged; the diagnostics are dropped either way.
Use instead
result.unwrap: a failure should stop the caller, with its code
Example
Result.valueOr(Result.fail('GEOMETRY_OP_FAILED', 'no hull'), []) // → []