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

0.1.0 • Public • Published

Functional async function

A golang function like helper for avoiding async function try...catch mental model.

Installation

  • Using npm

    $ npm install func-async --save
  • Using yarn

    $ yarn add func-async
    

Usage

import funcAsync from 'func-async'

export async function anyFunc() {
  const [answer, exception] = await funcAsync(anyPromiseLikeOperation())

  if (exception) {
    throw exception
  }

  if (answer) {
    // ...
  }
}

License

MIT @ Bowen Liu

/func-async/

    Package Sidebar

    Install

    npm i func-async

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    6.58 kB

    Total Files

    13

    Last publish

    Collaborators

    • lbwa