If the unwrapped value is Err, will map the error to an ok value with the given mapFn function.
mapFn
const wrapper = await wrap<string, number>(Promise.reject('error')) wrapper.unwrapOrElse((e: string) => 1) // 1
Last updated 1 year ago