A golang function like helper for avoiding async function try...catch
mental model.
-
Using
npm
$ npm install func-async --save
-
Using
yarn
$ yarn add func-async
import funcAsync from 'func-async'
export async function anyFunc() {
const [answer, exception] = await funcAsync(anyPromiseLikeOperation())
if (exception) {
throw exception
}
if (answer) {
// ...
}
}
MIT @ Bowen Liu