0.1.0 • Published 4 years ago

func-async v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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