Have ideas to improve npm?Join in the discussion! »

    eor
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.6 • Public • Published

    eor

    Eor is a try-catch wrapper that returns an [error, data] tuple.

    Eor, error or..., is written in Typescript and utilizes the language's builtin type-safety and type-inference capabilities. That said, it is compiled to Javascript, so it will work in any Javascript ecosystem.

    Installation

    npm install eor
    yarn add eor

    Usage

    Import

    import { eor } from 'eor'

    Invocation

    const [e, data] = await eor(myPromise)
    const [e, data] = eor(myFunction, input1, input2)

    Tuple Processing

    () => {
      const [e, data] = ...
      if (e) return bad(e)
      return good(data)
    }
    () => {
      const [e] = ...
      if (e) return bad(e)
      return good()
    }

    Install

    npm i eor

    DownloadsWeekly Downloads

    3

    Version

    0.1.6

    License

    MIT

    Unpacked Size

    3.89 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar