📦
unwrapit
  • 👋Welcome to unwrapit
  • Intro
    • 💡Why use it?
    • ✨Getting Started
  • APIs
    • 🔨wrap
    • 🔨unwrap
    • 🔨unwrapOr
    • 🔨unwrapOrElse
    • 🔨expect
    • 🔨mapErr
    • 🔨defineWrapConfig
    • 🔨ok
    • 🔨err
  • Type
    • 🔧Result
    • 🔧WrapConfig
    • 🔧WrapOption
    • 🔧Panic
  • Recipe
    • 🎨Export Wrapped Functions
    • 🎨Return Result Without `wrap` it
Powered by GitBook
On this page
  1. APIs

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
PreviousunwrapOrNextexpect

Last updated 1 year ago

🔨