🔨unwrapOrElse

If the unwrapped value is Err, will map the error to an ok value with the given mapFn function.

const wrapper = await wrap<string, number>(Promise.reject('error'))
wrapper.unwrapOrElse((e: string) => 1) // 1

Last updated