📦
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. Recipe

Export Wrapped Functions

It's common and useful for a library developer to export functions with a Result type. You can simply export your function by just wrap them.

Here's an example to show a safe function to parse JSON.

import {wrap} from 'unwrapit'

export const parseJson = wrap(JSON.parse)
PreviousPanicNextReturn Result Without `wrap` it

Last updated 1 year ago

🎨