1.1.0 • Published 6 years ago

@player1os/execute-async-function v1.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

NodeJS Execute Async Function

A small library that streamlines the direct execution of async functions

There are three benefits that come from using this library: 1. The passed async function is immediatly executed. 2. If the async function fails and no callback is supplied, the error will be thrown outside of the function. This will result in an UncaughtExecption instead of an UnhandledRejection. In my usecase, having the application crash on error is preferred. 3. The async function is executed outside of the context of any enclosing async function, thus errors are not caught by the enclosing function.

It is possible to supply a callback which is executed after the async function is finished. The callback follows the classic nodejs parameter convention (err: Error | null, result: any)