πŸ“¦
unwrapit
CtrlK
  • πŸ‘‹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

πŸ”¨unwrapOr

Use an alternative value when an error occurs.

const wrapper = await wrap<string, number>(Promise.reject('error'))
wrapper.unwrapOr(1) // 1
PreviousunwrapNextunwrapOrElse

Last updated 1 year ago